<configuration>

  <appender name="STDOUT"
            class="ch.qos.logback.core.ConsoleAppender">
    <layout class="ch.qos.logback.classic.PatternLayout">
      <Pattern>%-4relative [%thread] %-5level %X{testKey} - %msg%n"</Pattern>
    </layout>

    <filter class="ch.qos.logback.core.filter.EvaluatorFilter">  
      <Name>myFilter</Name>
      <OnMatch>DENY</OnMatch>
      <Evaluator class="ch.qos.logback.classic.boolex.JaninoEventEvaluator">
        <Name>mdcEvaluator</Name>
        <Expression>mdc!=null &amp;&amp; "val".equals(mdc.get("key"))</Expression>
      </Evaluator>
    </filter>
  </appender>

  <root level="debug">
    <appender-ref ref="STDOUT" />
  </root>
</configuration>

