[logback-dev] svn commit: r1076 - in logback/trunk: logback-examples/src/main/java/chapter6 logback-site/src/site/xdocTemplates/manual

noreply.seb at qos.ch noreply.seb at qos.ch
Tue Dec 12 20:04:56 CET 2006


Author: seb
Date: Tue Dec 12 20:04:56 2006
New Revision: 1076

Modified:
   logback/trunk/logback-examples/src/main/java/chapter6/SampleFilter.java
   logback/trunk/logback-examples/src/main/java/chapter6/SampleTurboFilter.java
   logback/trunk/logback-site/src/site/xdocTemplates/manual/filters.xml
   logback/trunk/logback-site/src/site/xdocTemplates/manual/index.xml
   logback/trunk/logback-site/src/site/xdocTemplates/manual/mdc.xml

Log:
on going work


Modified: logback/trunk/logback-examples/src/main/java/chapter6/SampleFilter.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter6/SampleFilter.java	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter6/SampleFilter.java	Tue Dec 12 20:04:56 2006
@@ -9,7 +9,7 @@
   @Override
   public FilterReply decide(Object eventObject) {
     LoggingEvent event = (LoggingEvent)eventObject;
-    if (event.getMessage().contains("sample")) {
+    if (event.getMessage() != null && event.getMessage().contains("sample")) {
       return FilterReply.ACCEPT;
     } else {
       return FilterReply.NEUTRAL;

Modified: logback/trunk/logback-examples/src/main/java/chapter6/SampleTurboFilter.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter6/SampleTurboFilter.java	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter6/SampleTurboFilter.java	Tue Dec 12 20:04:56 2006
@@ -10,10 +10,13 @@
 
 public class SampleTurboFilter extends TurboFilter {
 
+  Marker sampleMarker = MarkerFactory.getMarker("sample");
+
   @Override
   public FilterReply decide(Marker marker, Logger logger, Level level,
       String format, Object[] params, Throwable t) {
-    if ((MarkerFactory.getMarker("sample").equals(marker))) {
+
+    if ((sampleMarker.equals(marker))) {
       return FilterReply.ACCEPT;
     } else {
       return FilterReply.NEUTRAL;

Modified: logback/trunk/logback-site/src/site/xdocTemplates/manual/filters.xml
==============================================================================
--- logback/trunk/logback-site/src/site/xdocTemplates/manual/filters.xml	(original)
+++ logback/trunk/logback-site/src/site/xdocTemplates/manual/filters.xml	Tue Dec 12 20:04:56 2006
@@ -5,10 +5,10 @@
 		Since "source" divs use pre as white-space, it affects the
 		look of the code parts in this document.
 		
-	-->
+-->
 
 	<body>
-		<h2>Chapter 6: Filters</h2>
+		<h2>Chapter 6: Filter chains</h2>
 		<div class="author">
 			Authors: Ceki G&#252;lc&#252;, S&#233;bastien Pennec
 		</div>
@@ -239,7 +239,7 @@
 			logging event should be accepted, or rejected.
 		</p>
 		
-		<h2>Implementing your own Filter</h2>
+		<h3>Implementing your own Filter</h3>
 		
 		<p>
 			Creating your own filter is not difficult. If your filter doesn't need any evaluation
@@ -283,7 +283,6 @@
 
 <em>Example 6.3: SampleFilter configuration (logback-examples/src/main/java/chapter6/SampleFilterConfig.xml)</em>				
 <div class="source"><pre>&lt;configuration>
-
   &lt;appender name="STDOUT"
     class="ch.qos.logback.core.ConsoleAppender">
     <b>&lt;Filter class="chapter6.SampleFilter" /></b>
@@ -434,7 +433,7 @@
 		</p>
 		
 		
-	  <h2>Implementing your own TurboFilter</h2>
+	  <h3>Implementing your own TurboFilter</h3>
     
     <p>
       To create your own <code>TurboFilter</code> component, just extend the 
@@ -443,7 +442,7 @@
       ask that one implement the <code>decide()</code> method, as shown below:
     </p>
     
-<em>Example 6.5: Basic custom <code>TurboFilter</code> (<a href="../xref/chapter6/SampleTurboFilter.html">logback-examples/src/main/java/chapter6/SampleFilter.java</a>)</em>		
+<em>Example 6.5: Basic custom <code>TurboFilter</code> (<a href="../xref/chapter6/SampleTurboFilter.html">logback-examples/src/main/java/chapter6/SampleTurboFilter.java</a>)</em>		
 <div class="source"><pre>package chapter6;
 
 import org.slf4j.Marker;
@@ -474,7 +473,9 @@
 		</p>
 		
 		<p>
-			
+			Like any other logback component, adding an option only requires implementing the
+			getter and setter methods in the corresponding class. Once done, the option can be specified
+			by adding nested elements inside the <em>TurboFilter</em> element.
 		</p>
     
     
@@ -486,7 +487,11 @@
     	Logback access benefits from most of the possibilities available
     	to the classic module. <code>Filter</code> objects are available and work
     	in the same way as their classic counterpart. They handle access' implementation
-    	of logging events: <code>AccessEvent</code>. On the other hand,
+    	of logging events: <code>AccessEvent</code>. 
+    	Thus, a customized filter
+    	for logback access is follows strictly the same rules than one for the 
+    	classic module, except for the event implemenation recieved as a parameter.
+    	On the other hand,
     	<code>TurboFilter</code> objects are not available to the access module.
     </p>
     

Modified: logback/trunk/logback-site/src/site/xdocTemplates/manual/index.xml
==============================================================================
--- logback/trunk/logback-site/src/site/xdocTemplates/manual/index.xml	(original)
+++ logback/trunk/logback-site/src/site/xdocTemplates/manual/index.xml	Tue Dec 12 20:04:56 2006
@@ -67,6 +67,14 @@
         <li><p>
           <a href="layouts.html"><b>Chapter 5: Layouts</b></a>
         </p></li>
+        
+        <li><p>
+          <a href="layouts.html"><b>Chapter 6: Filter chains</b></a>
+        </p></li>
+        
+        <li><p>
+          <a href="layouts.html"><b>Chapter 7: Diagnostic Context</b></a>
+        </p></li>
       </ul>
     </div>
 	</body>

Modified: logback/trunk/logback-site/src/site/xdocTemplates/manual/mdc.xml
==============================================================================
--- logback/trunk/logback-site/src/site/xdocTemplates/manual/mdc.xml	(original)
+++ logback/trunk/logback-site/src/site/xdocTemplates/manual/mdc.xml	Tue Dec 12 20:04:56 2006
@@ -8,7 +8,7 @@
 	-->
 
 	<body>
-		<h2>Chapter 7: Mapped Diagnostic Context</h2>
+		<h2>Chapter 7: Diagnostic Context</h2>
 		<div class="author">
 			Authors: Ceki G&#252;lc&#252;, S&#233;bastien Pennec
 		</div>



More information about the logback-dev mailing list