[logback-user] How To Use Filters

Yoram Forscher yoramf at envoytech.com
Wed Dec 20 20:18:12 CET 2006


After reading chapter 6, "Filter Chains," I tried to use some filters
myself with no success. My configuration file contains the following:

 

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">

<filter class="ch.qos.logback.core.filter.EvaluatorFilter">

                        <evaluator name="myEval">

 
<expression>marker.getName().equals("printConfiguration")</expression>

                        </evaluator>

                        <OnMismatch>NEUTRAL</OnMismatch>

                        <OnMatch>DENY</OnMatch>

            </filter>

            <layout class="ch.qos.logback.classic.PatternLayout">

                        <param name="pattern" value="%d{ISO8601} %-5p
[%c{40}] %m%n"/>

            </layout>

</appender>

 

In my code I have the following:

private Marker pcMarker = MarkerFactory.getMarker("printConfiguration");

...

logger.debug(pcMarker, "Configuration Information");

...

 

I expect in that case that no output will be created, but it keeps
printing it regardless of how I set it up. I also tried to change the
expression to 'marker.contains("printConfiguration")' and change the
OnMismatch and OnMatch both to DENY. Same result.

 

What am I doing wrong?

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://qos.ch/pipermail/logback-user/attachments/20061220/815c77ba/attachment.htm 


More information about the Logback-user mailing list