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?