[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v_0.9.25-19-g5ea5892

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Thu Nov 4 21:59:54 CET 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".

The branch, master has been updated
       via  5ea58922aea25355a84eb146b554fc72cc8af391 (commit)
      from  cc94d919ec6ce8cc90e1e3a0cd8f26c52f27ee47 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=5ea58922aea25355a84eb146b554fc72cc8af391
http://github.com/ceki/logback/commit/5ea58922aea25355a84eb146b554fc72cc8af391

commit 5ea58922aea25355a84eb146b554fc72cc8af391
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Thu Nov 4 21:58:39 2010 +0100

    working on the documentation

diff --git a/logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker.xml b/logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker.xml
index 4095d5b..50ca099 100644
--- a/logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker.xml
+++ b/logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker.xml
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 
 <configuration>
+  <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />  
+
   <appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
     <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
       <marker>NOTIFY_ADMIN</marker>
diff --git a/logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker.xml b/logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker_GEventEvaluator.xml
similarity index 59%
copy from logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker.xml
copy to logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker_GEventEvaluator.xml
index 4095d5b..d4fdead 100644
--- a/logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker.xml
+++ b/logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker_GEventEvaluator.xml
@@ -1,11 +1,13 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 
 <configuration>
+  <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />  
+
   <appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
-    <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
-      <marker>NOTIFY_ADMIN</marker>
-      <!-- you specify add as many markers as you want -->
-      <marker>ANOTHER_MARKER</marker>
+    <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator">
+      <expression>
+        e.marker?.contains("NOTIFY_ADMIN") || e.marker?.contains("TRANSACTION_FAILURE")
+      </expression>
     </evaluator>
     <SMTPHost>${smtpHost}</SMTPHost>
     <To>${to}</To>
diff --git a/logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker.xml b/logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker_Janino.xml
similarity index 56%
copy from logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker.xml
copy to logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker_Janino.xml
index 4095d5b..de98ef0 100644
--- a/logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker.xml
+++ b/logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker_Janino.xml
@@ -1,11 +1,14 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 
 <configuration>
+  <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />  
+
   <appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
-    <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
-      <marker>NOTIFY_ADMIN</marker>
-      <!-- you specify add as many markers as you want -->
-      <marker>ANOTHER_MARKER</marker>
+    <evaluator class="ch.qos.logback.classic.boolex.JaninoEventEvaluator">
+      <expression>
+        (marker != null) &amp;&amp;
+        (marker.contains("NOTIFY_ADMIN") || marker.contains("TRANSACTION_FAILURE"))
+      </expression>
     </evaluator>
     <SMTPHost>${smtpHost}</SMTPHost>
     <To>${to}</To>
diff --git a/logback-site/src/site/pages/documentation.html b/logback-site/src/site/pages/documentation.html
index 3665b26..3282dc5 100644
--- a/logback-site/src/site/pages/documentation.html
+++ b/logback-site/src/site/pages/documentation.html
@@ -35,6 +35,9 @@
 				<a href="access.html">An introduction to logback-access for Jetty
 				and Tomcat</a>
 			</li>
+
+      <li><a href="recipes/index.html">The logback recipes</a></li>
+
       <li>
       	<a href="faq.html">A Frequently Asked Questions list (FAQ)</a>
       </li>
diff --git a/logback-site/src/site/pages/manual/appenders.html b/logback-site/src/site/pages/manual/appenders.html
index 1bfbe1f..7e6c34c 100644
--- a/logback-site/src/site/pages/manual/appenders.html
+++ b/logback-site/src/site/pages/manual/appenders.html
@@ -2232,7 +2232,8 @@ Context ctx = new InitialContext(env);</pre>
         </td>
       </tr>
       <tr >
-        <td><b><span class="option">Evaluator</span></b></td>
+        <td><b><span class="option"><a name="smtpAppender_Evaluator"
+        href="#smtpAppender_Evaluator">Evaluator</a></span></b></td>
         <td><code><a
         href="../xref/ch/qos/logback/classic/boolex/IEvaluator.html">IEvaluator</a></code></td>
         <td>
@@ -2265,7 +2266,9 @@ Context ctx = new InitialContext(env);</pre>
           (discussed below) and a powerful evaluator called <a
           href="../xref/ch/qos/logback/classic/boolex/JaninoEventEvaluator.html"><code>JaninoEventEvaluator</code></a>,
           discussed in <a href="filters.html#evalutatorFilter">another
-          chapter</a>.
+          chapter</a>. The more recent versions of logback ship with
+          an even more powerful evaluator called <a
+          href="filters.html#GEventEvaluator"><code>GEventEvaluator</code></a>.
           </p>
 
         </td>
@@ -2644,7 +2647,60 @@ logger.error(<b>notifyAdminMarker</b>,
   chapters.appenders.mail.Marked_EMail src/main/java/chapters/appenders/mail/mailWithMarker.xml</pre>
 
 
-    
+    <p>Note that instead of using the marker-centric
+    OnMarkerEvaluator, we could use the much more generic <a
+    href="filters.html#JaninoEventEvaluator"><code>JaninoEventEvaluator</code></a>
+    or its even more powerful cousin <a
+    href="filters.html#GEventEvaluator"><code>GEventEvaluator</code></a>.
+    </p>
+
+    <p>The following configuration file uses JaninoEventEvaluator
+    instead of OnMarkerEvaluator but is otherwise equivalent to the
+    previous configuration file.
+    </p>
+
+    <p class="example">Example: <code>SMTPAppender</code> with 
+   <code>JaninoEventEvaluator</code> (logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker_Janino.xml)</p>
+
+   <span class="asGroovy" onclick="return asGroovy('mailWithMarker_Janino');">View as .groovy</span>	
+    <pre id="mailWithMarker_Janino" class="prettyprint source">&lt;configuration>
+  &lt;appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
+    &lt;evaluator class="ch.qos.logback.classic.boolex.JaninoEventEvaluator">
+      &lt;expression>
+        (marker != null) &amp;&amp;
+        (marker.contains("NOTIFY_ADMIN") || marker.contains("TRANSACTION_FAILURE"))
+      &lt;/expression>
+    &lt;/evaluator>    
+    ... same as above
+  &lt;/appender>
+&lt;/configuration></pre>
+
+    <p>Here is the equivalent evaluator using <a
+    href="filters.html#GEventEvaluator">GEventEvaluator</a>.</p>
+
+    <p class="example">Example: the same with 
+   <code>GEventEvaluator</code> (logback-examples/src/main/java/chapters/appenders/mail/mailWithMarker_GEvent.xml)</p>
+   <span class="asGroovy" onclick="return asGroovy('mailWithMarker_GEventEvaluator');">View as .groovy</span>	
+
+   <pre id="mailWithMarker_GEventEvaluator" class="prettyprint source">&lt;configuration>
+  &lt;appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
+    &lt;evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator">
+      &lt;expression>
+        e.marker?.contains("NOTIFY_ADMIN") || e.marker?.contains("TRANSACTION_FAILURE")
+      &lt;/expression>
+    &lt;/evaluator>    
+    ... same as above
+  &lt;/appender>
+&lt;/configuration></pre>
+
+    <p>Note that since the event may lack a marker, the value of
+    e.marker can be null. Hence the use of Groovy's <a
+    href="http://groovy.codehaus.org/Null+Object+Pattern">safe
+    derefencing opeator</a>, that is the .? operator.
+    </p>
+
+
+
     <h3><a name="smtpAuthentication"
     href="#smtpAuthentication">Authentication/STARTTLS/SSL</a></h3>
 
diff --git a/logback-site/src/site/pages/manual/filters.html b/logback-site/src/site/pages/manual/filters.html
index 6a7ef15..b698e74 100644
--- a/logback-site/src/site/pages/manual/filters.html
+++ b/logback-site/src/site/pages/manual/filters.html
@@ -272,15 +272,15 @@ public class SampleFilter extends Filter&gt;ILoggingEvent> {
     is a concrete <a
     href="../xref/ch/qos/logback/core/boolex/EventEvaluator.html"><code>EventEvaluator</code></a>
     implementation taking artibtrary Groovy language boolean
-    expressions as the evaluation criteria. It admits an arbitrary
-    boolean expression written in Groovy. We refer such groovy
-    language boolean expressions as "groovy evaulation
+    expressions as the evaluation criteria.  We refer such groovy
+    language boolean expressions as "groovy evalation
     expressions". Groovy evaluation expressions enable hereto
     unprecedented flexibility in event
     filtering. <code>GEventEvaluator</code> requires the Groovy
     runtime. Please see the <a
     href="../setup.html#gEventEvaluator">corresponding section</a> of
-    the setup document.
+    the setup document on adding the Groovy runtinme to your class
+    path.
     </p>
 
     <p>Evaluation expressions are compiled on-the-fly during the
@@ -292,14 +292,16 @@ public class SampleFilter extends Filter&gt;ILoggingEvent> {
 
     <p>The evaluation expression acts on the current logging event,
     logback automatically inserts the current logging event of type <a
-    href="../apidocs/ch/qos/logback/classic/spi/ILoggingEvent.html">ILoggingEvent.</a>
-    as a variable called 'event' and its shorthand 'e'. The variables
-    TRACE, DEBUG, INFO, WARN and ERROR are also exported into the
-    scope of the expression. Thus, "event.level == DEBUG" is a valid
-    groovy expression which will return <code>true</code> only if the
-    current logging event's level is identical to DEBUG. For other
-    comparison operators, the level field should be converter to
-    integer with the <code>toInt()</code> operator.
+    href="../apidocs/ch/qos/logback/classic/spi/ILoggingEvent.html">ILoggingEvent</a>
+    as a variable referred to as '<em>event</em>' as well as its
+    shorthand referred to as '<em>e</em>'. The variables TRACE, DEBUG,
+    INFO, WARN and ERROR are also exported into the scope of the
+    expression. Thus, "event.level == DEBUG" and "e.level == DEBUG"
+    are equvalent and valid groovy expressions which will return
+    <code>true</code> only if the current logging event's level is
+    identical to DEBUG. For other comparison operators on levels, the
+    level field should be converted to integer with the
+    <code>toInt()</code> operator.
     </p>
 
     <p>Here is a more complete example.</p>
diff --git a/logback-site/src/site/pages/recipes/emailPerTransaction.html b/logback-site/src/site/pages/recipes/emailPerTransaction.html
index 74272ad..edb62c0 100644
--- a/logback-site/src/site/pages/recipes/emailPerTransaction.html
+++ b/logback-site/src/site/pages/recipes/emailPerTransaction.html
@@ -52,18 +52,26 @@
         </li>
       </ol>
 
-      <p>Given the above circumstances, let us create a setup so that
-      Tata receives an email message containing the logs generated by
-      a single transaction as shown next. We will later refine the
-      setup so that Tata reveies an email per transaction but only for
-      the transactions she explicitly selects.
+      <p>Given the above circumstances, let us create a logback
+      configuration so that Tata receives an email message containing
+      the logs generated by a single transaction. We will later refine
+      this configuration so that Tata will receive an email per transaction
+      but only for the transactions she explicitly selects.
       </p>
 
       <h3>Generating an email message containing the logs of a single
       transaction
       </h3>
 
-      <pre class="prettyprint source">&lt;configuration scan="true" scanPeriod="3 seconds">
+      <p>We will be using <code>SMTPAppender</code> to generate emails
+      containing logging data. Please refer to the <a
+      href="../manual/appenders.html#SMTPAppender">appropriate section
+      of the manual</a> to familiarize yourself with
+      <code>SMTPAppender</code>.
+
+is described in chapter on
+      appenders describes <pre class="prettyprint
+      source">&lt;configuration scan="true" scanPeriod="3 seconds">
 
   &lt;statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
 

-----------------------------------------------------------------------

Summary of changes:
 .../chapters/appenders/mail/mailWithMarker.xml     |    2 +
 ...rker.xml => mailWithMarker_GEventEvaluator.xml} |   10 ++-
 ...ailWithMarker.xml => mailWithMarker_Janino.xml} |   11 ++-
 logback-site/src/site/pages/documentation.html     |    3 +
 logback-site/src/site/pages/manual/appenders.html  |   62 +++++++++++++++++++-
 logback-site/src/site/pages/manual/filters.html    |   26 +++++----
 .../site/pages/recipes/emailPerTransaction.html    |   20 +++++--
 7 files changed, 105 insertions(+), 29 deletions(-)
 copy logback-examples/src/main/java/chapters/appenders/mail/{mailWithMarker.xml => mailWithMarker_GEventEvaluator.xml} (59%)
 copy logback-examples/src/main/java/chapters/appenders/mail/{mailWithMarker.xml => mailWithMarker_Janino.xml} (56%)


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.


More information about the logback-dev mailing list