Class ExceptionMatchEvaluator

java.lang.Object
All Implemented Interfaces:
EventEvaluator<ILoggingEvent>, ContextAware, LifeCycle

A simple EventEvaluator that checks whether the logging event being evaluated has a throwable of the same class as specified by the exceptionClass parameter.

Here is a

  <configuration>
     <import class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"/>
     <import class="ch.qos.logback.core.filter.EvaluatorFilter"/>
     <import class="ch.qos.logback.classic.boolex.ExceptionMatchEvaluator"/>
     <import class="ch.qos.logback.core.ConsoleAppender"/>

     <appender name="CONSOLE" class="ConsoleAppender">
         <filter class="EvaluatorFilter">
             <evaluator class="ExceptionMatchEvaluator">
                 <exceptionClass>java.lang.RuntimeException</exceptionClass>
             </evaluator>
             <OnMismatch>DENY</OnMismatch>
             <OnMatch>NEUTRAL</OnMatch>
         </filter>

         <encoder class="PatternLayoutEncoder">
             <pattern>%-4relative [%thread] %-5level %logger -%kvp -%msg%n</pattern>
         </encoder>
     </appender>

     <root level="INFO">
         <appender-ref ref="CONSOLE"/>
     </root>
 </configuration>