svn commit: r640 - in logback/trunk: logback-access/src/main/java/ch/qos/logback/access/net logback-core/examples/src/joran/calculator logback-core/examples/src/joran/helloWorld logback-core/examples/src/joran/implicit logback-core/examples/src/joran/newRule logback-site/src/site/xdocTemplates

Author: seb Date: Mon Oct 9 14:38:44 2006 New Revision: 640 Added: logback/trunk/logback-core/examples/src/joran/calculator/readme.txt logback/trunk/logback-core/examples/src/joran/helloWorld/readme.txt logback/trunk/logback-core/examples/src/joran/implicit/readme.txt logback/trunk/logback-core/examples/src/joran/newRule/readme.txt Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java logback/trunk/logback-site/src/site/xdocTemplates/documentation.xml logback/trunk/logback-site/src/site/xdocTemplates/joran.xml logback/trunk/logback-site/src/site/xdocTemplates/mailinglist.xml Log: - minor code fixes - added readMe in the core examples packages - modified joran documentation: WORK IN PROGRESS - added links to the archives of our mailing lists. Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java ============================================================================== --- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java (original) +++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/net/SMTPAppender.java Mon Oct 9 14:38:44 2006 @@ -120,9 +120,9 @@ private boolean started; - private static final Integer TRIGGERING_STATUS_CODE = 500; + private static final int TRIGGERING_STATUS_CODE = 500; private static final long ONE_DAY = 1000*60*60*24; - private static long LAST_TRIGGER_DATE = 0L; + private long LAST_TRIGGER_DATE = 0L; /** @@ -138,7 +138,7 @@ public boolean isTriggeringEvent(File file, Object eventObject) { AccessEvent event = (AccessEvent) eventObject; - if (TRIGGERING_STATUS_CODE.compareTo(event.getStatusCode()) <= 0) { + if (TRIGGERING_STATUS_CODE <= event.getStatusCode()) { if (System.currentTimeMillis() >= LAST_TRIGGER_DATE + ONE_DAY) { LAST_TRIGGER_DATE = System.currentTimeMillis(); return true; Added: logback/trunk/logback-core/examples/src/joran/calculator/readme.txt ============================================================================== --- (empty file) +++ logback/trunk/logback-core/examples/src/joran/calculator/readme.txt Mon Oct 9 14:38:44 2006 @@ -0,0 +1,17 @@ ++------------------------------+ +| | +| Joran Examples | +| | +| Calculator | +| | ++------------------------------+ + +This directory contains the the calculator example. + +It shows how Actions can collaborate in order to accomplish a simple +computation. + +For more in-depth informations about this example, please visit: + +http://logback.qos.ch/joran.html#calculator + Added: logback/trunk/logback-core/examples/src/joran/helloWorld/readme.txt ============================================================================== --- (empty file) +++ logback/trunk/logback-core/examples/src/joran/helloWorld/readme.txt Mon Oct 9 14:38:44 2006 @@ -0,0 +1,16 @@ ++------------------------------+ +| | +| Joran Examples | +| | +| Hello World | +| | ++------------------------------+ + +This directory contains the simplest examples of the Joran tutorial. + +It includes a trivial action and a sample setup of Joran Interpreter. + +For more in-depth informations about this example, please visit: + +http://logback.qos.ch/joran.html#helloWorld + Added: logback/trunk/logback-core/examples/src/joran/implicit/readme.txt ============================================================================== --- (empty file) +++ logback/trunk/logback-core/examples/src/joran/implicit/readme.txt Mon Oct 9 14:38:44 2006 @@ -0,0 +1,17 @@ ++------------------------------+ +| | +| Joran Examples | +| | +| Implicit | +| | ++------------------------------+ + +This directory contains the implicit action example. + +It shows how to use implicit actions, which do not require an explicit +pattern. + +For more in-depth informations about this example, please visit: + +http://logback.qos.ch/joran.html#implicit + Added: logback/trunk/logback-core/examples/src/joran/newRule/readme.txt ============================================================================== --- (empty file) +++ logback/trunk/logback-core/examples/src/joran/newRule/readme.txt Mon Oct 9 14:38:44 2006 @@ -0,0 +1,17 @@ ++------------------------------+ +| | +| Joran Examples | +| | +| New rule | +| | ++------------------------------+ + +This directory contains an example using the new rule action. + +It shows how Joran can learn new rules on the fly, while interpreting +the xml file. + +For more in-depth informations about this example, please visit: + +http://logback.qos.ch/joran.html#newRule + Modified: logback/trunk/logback-site/src/site/xdocTemplates/documentation.xml ============================================================================== --- logback/trunk/logback-site/src/site/xdocTemplates/documentation.xml (original) +++ logback/trunk/logback-site/src/site/xdocTemplates/documentation.xml Mon Oct 9 14:38:44 2006 @@ -27,7 +27,7 @@ </li> <li> - <a href="joran.html">A introduction to Joran</a> + <a href="joran.html"><b>A introduction to Joran</b></a> </li> </ul> Modified: logback/trunk/logback-site/src/site/xdocTemplates/joran.xml ============================================================================== --- logback/trunk/logback-site/src/site/xdocTemplates/joran.xml (original) +++ logback/trunk/logback-site/src/site/xdocTemplates/joran.xml Mon Oct 9 14:38:44 2006 @@ -31,7 +31,8 @@ <em>LOGBACK_HOME/logback-core/examples/src/joran</em>. </p> -<p>Missing: setup instructions</p> +<p>To install joran, simply <a href="download.html">download</a> +logback and add logback core module to your classpath.</p> <h2>Historical perspective</h2> @@ -163,31 +164,70 @@ <code>StatusManager</code>. </p> +<a name="helloWorld" /> <h3>A hello world example</h3> <p>The <em>examples/src/joran/helloWorld/</em> directory includes a -trivial action and Joran interpreter setup which just diaplays "hello -world" when a <hello-world> element is encountered in an XML file. -Look into this example to learn about the basic steps which are +trivial action and Joran interpreter setup which just diaplays "Hello +World" when a <hello-world> element is encountered in an XML file. +It also includes the basic steps which are necessary to set up and invoke a Joran interpreter. </p> +<p> +The <em>hello.xml</em> file contains only one element, without any +other nested elements. The <code>HelloWorldAction</code> class is +a trivial implementation: it only prints "Hello World" in the console when +it's <code>begin()</code> method is called. +</p> +<p> +<code>HelloWorld</code> is a class that sets up the Joran interpreter, +with the minimal steps necessary: +</p> + +<ul> + <!-- Pretty dirty, thanks site-generation... --> + <p>It creates a <code>RuleStore</code> and a <code>Context</code></p> + <p>It adds the <em>hello-world</em> pattern, with it's corresponding action</p> + <p>It creates a Joran interpreted, and passes the <code>RuleStore</code></p> + <p>It creates a SAX parser and parses the given file, specifying the newly created + Joran interpreter as the <code>ContentHandler</code></p> +</ul> + +<p> +It's last step is to print the content of the <code>Context</code>. +Since Joran uses logback's powerfull <code>Status</code> objects for +error reporting, one can have a good feedback on what happened during +the parsing. +</p> + +<p> +In this example, the parsing is rather simple. The <em>hello-world</em> element +will activate <code>HelloWorldAction</code>'s <code>begin()</code> and +<code>end()</code> methods. +In the first method, a simple call to <code>System.out.println()</code> +will be issued, displaying "Hello World" in the console. +</p> +<a name="calculator" /> <h3>Collaborating actions</h3> - +<p><em>More in-depths text to come</em></p> +<p> The examples/src/joran/calculator/ directory includes several actions which collaborate together through the common object stack in order to accomplish simple computations. - +</p> +<a name="newRule" /> <h3>New-rule action</h3> - +<p><em>More in-depths text to come</em></p> <p>Joran includes an action which allows the Joran interpreter to lean new rules on the fly while interpreting the XML file containing the new rules. See the <em>logback-core/examples/src/joran/newRule/</em> directory for sample code. </p> +<a name="implicit" /> <h3>Implicit actions </h3> - +<p><em>More in-depths text to come</em></p> <p>The rules defined thus far are called explicit rules because they require an explicit pattern, hence fixing the tag name of the elements for which they apply. Modified: logback/trunk/logback-site/src/site/xdocTemplates/mailinglist.xml ============================================================================== --- logback/trunk/logback-site/src/site/xdocTemplates/mailinglist.xml (original) +++ logback/trunk/logback-site/src/site/xdocTemplates/mailinglist.xml Mon Oct 9 14:38:44 2006 @@ -38,10 +38,10 @@ <table class="bodyTable"> <tr class="a"> <th>Name</th> - <th>Volume</th> + <th>Volume</th> <th>Subscribe</th> <th>Unsubscribe</th> - <th>Archive</th> + <th>Archives</th> </tr> <tr class="b"> <td>Logback Announce List</td> @@ -53,12 +53,23 @@ </a> </td> <td> - <a href="http://qos.ch/mailman/options/logback-announce">Unsubscribe</a> - </td> + <a + href="http://qos.ch/mailman/options/logback-announce"> + Unsubscribe + </a> + </td> <td> <a href="http://www.qos.ch/pipermail/logback-announce/"> - www.qos.ch + qos.ch + </a> + <a + href="http://marc.theaimsgroup.com/?l=logback-announce"> + MARC + </a> + <a + href="http://www.nabble.com/Logback-Announce-f16251.html"> + Nabble </a> </td> </tr> @@ -76,17 +87,26 @@ href="http://qos.ch/mailman/options/logback-user"> Unsubscribe </a> - </td> + </td> <td> <a href="http://www.qos.ch/pipermail/logback-user/"> - www.qos.ch + qos.ch + </a> + <a + href="http://marc.theaimsgroup.com/?l=logback-user"> + MARC + </a> + + <a + href="http://www.nabble.com/Logback-User-f16252.html"> + Nabble </a> </td> </tr> <tr class="b"> <td>Logback Dev List</td> - <td>Medium</td> + <td>Medium</td> <td> <a href="http://qos.ch/mailman/listinfo/logback-dev"> @@ -98,11 +118,19 @@ href="http://qos.ch/mailman/options/logback-dev"> Unsubscribe </a> - </td> + </td> <td> <a href="http://www.qos.ch/pipermail/logback-dev/"> - www.qos.ch + qos.ch + </a> + <a + href="http://marc.theaimsgroup.com/?l=logback-dev"> + MARC + </a> + <a + href="http://www.nabble.com/Logback-Dev-f16253.html"> + Nabble </a> </td> </tr>
participants (1)
-
noreply.seb@qos.ch