[logback-dev] svn commit: r1067 - 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
Wed Dec 6 14:51:07 CET 2006
Author: seb
Date: Wed Dec 6 14:51:06 2006
New Revision: 1067
Added:
logback/trunk/logback-examples/src/main/java/chapter6/accessEventEvaluator2.xml
Modified:
logback/trunk/logback-site/src/site/xdocTemplates/manual/filters.xml
Log:
added another examples of filter usage in lb access
Added: logback/trunk/logback-examples/src/main/java/chapter6/accessEventEvaluator2.xml
==============================================================================
--- (empty file)
+++ logback/trunk/logback-examples/src/main/java/chapter6/accessEventEvaluator2.xml Wed Dec 6 14:51:06 2006
@@ -0,0 +1,27 @@
+<configuration>
+
+ <appender name="STDOUT"
+ class="ch.qos.logback.core.ConsoleAppender">
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator name="Eval404">
+ <expression>event.getStatusCode() == 404</expression>
+ </evaluator>
+ <OnMismatch>NEUTRAL</OnMismatch>
+ <OnMatch>ACCEPT</OnMatch>
+ </filter>
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator name="EvalCSS">
+ <expression>event.getRequestURI().contains("css")</expression>
+ </evaluator>
+ <OnMismatch>NEUTRAL</OnMismatch>
+ <OnMatch>DENY</OnMatch>
+ </filter>
+ <layout class="ch.qos.logback.access.PatternLayout">
+ <pattern>
+ %h %l %u %t %r %s %b
+ </pattern>
+ </layout>
+ </appender>
+
+ <appender-ref ref="STDOUT" />
+</configuration>
\ No newline at end of file
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 Wed Dec 6 14:51:06 2006
@@ -389,26 +389,59 @@
<em>Example 6.3: Access Evaluator (logback-examples/src/main/java/chapter6/accessEventEvaluator.xml)</em>
<div class="source"><pre><configuration>
- <appender name="STDOUT"
- class="ch.qos.logback.core.ConsoleAppender">
- <b><filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator name="myEval">
- <expression>event.getStatusCode() == 404</expression>
- </evaluator>
- <OnMismatch>NEUTRAL</OnMismatch>
- <OnMatch>ACCEPT</OnMatch>
- </filter></b>
- <layout class="ch.qos.logback.access.PatternLayout">
- <pattern>
- %h %l %u %t %r %s %b
- </pattern>
- </layout>
- </appender>
+ <appender name="STDOUT"
+ class="ch.qos.logback.core.ConsoleAppender">
+ <b><filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator name="myEval">
+ <expression>event.getStatusCode() == 404</expression>
+ </evaluator>
+ <OnMismatch>NEUTRAL</OnMismatch>
+ <OnMatch>ACCEPT</OnMatch>
+ </filter></b>
+ <layout class="ch.qos.logback.access.PatternLayout">
+ <pattern>
+ %h %l %u %t %r %s %b
+ </pattern>
+ </layout>
+ </appender>
- <appender-ref ref="STDOUT" />
+ <appender-ref ref="STDOUT" />
</configuration></pre></div>
+ <p>
+ We might imagine a slightly more complex use of filters to ensure the display of 404 errors, but
+ to prevent polluting the output with endless accesses to CSS files. Here is what such a configuration
+ would look like:
+ </p>
+<em>Example 6.4: Access Evaluator (logback-examples/src/main/java/chapter6/accessEventEvaluator2.xml)</em>
+<div class="source"><pre><configuration>
+
+ <appender name="STDOUT"
+ class="ch.qos.logback.core.ConsoleAppender">
+ <b><filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator name="Eval404">
+ <expression>event.getStatusCode() == 404</expression>
+ </evaluator>
+ <OnMismatch>NEUTRAL</OnMismatch>
+ <OnMatch>ACCEPT</OnMatch>
+ </filter>
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator name="EvalCSS">
+ <expression>event.getRequestURI().contains("css")</expression>
+ </evaluator>
+ <OnMismatch>NEUTRAL</OnMismatch>
+ <OnMatch>DENY</OnMatch>
+ </filter></b>
+ <layout class="ch.qos.logback.access.PatternLayout">
+ <pattern>
+ %h %l %u %t %r %s %b
+ </pattern>
+ </layout>
+ </appender>
+ <appender-ref ref="STDOUT" />
+</configuration></pre></div>
+
</body>
</document>
\ No newline at end of file
More information about the logback-dev
mailing list