title: log4j2 DynamicThresholdFilter not picking up property value
body: <p>Trying to set different printing levels for console and file. </p>
  
  <p>Goal is: when <strong>debug=true</strong>, print <strong>debug level</strong> (console &amp; file), else only print <strong>error level</strong> (console). </p>
  
  <p>Change it <em>programatically</em> like this:</p>
  
  <pre><code> @Override
     public void contextInitialized(ServletContextEvent sce) {
         ThreadContext.put("debugMode", "true");
     }
  </code></pre>
  
  <p>This is my log4j2 configuration: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Configuration status="debug"&gt;
     &lt;Properties&gt;
         &lt;Property name="logPath"&gt;${sys:catalina.home}&lt;/Property&gt;
         &lt;Property name="rollingFileName"&gt;vsTenant&lt;/Property&gt;
     &lt;/Properties&gt;
  
     &lt;Appenders&gt;                                   
         &lt;Console name="console" target="SYSTEM_OUT"&gt;  
             &lt;filters&gt;&gt;   
                  &lt;DynamicThresholdFilter key="debugMode" defaultThreshold="ERROR" onMatch="ACCEPT" onMismatch="NEUTRAL"&gt;
                     &lt;KeyValuePair key="true" value="DEBUG"/&gt;    
                     &lt;KeyValuePair key="false" value="ERROR"/&gt;       
                 &lt;/DynamicThresholdFilter&gt;              
             &lt;/filters&gt;                         
             &lt;PatternLayout pattern="%d{HH:mm:ss.SSS} [%thread] %-5level [vsTenant] %logger{36} - %msg\n%n" /&gt;
         &lt;/Console&gt;                
  
         &lt;RollingFile name="rollingFile" fileName="${logPath}/logs/vsTenant.log" filePattern="${logPath}/logs/vsTenant_%d{dd-MM-yyyy}.log"&gt;            
            &lt;filters&gt;&gt;   
                  &lt;DynamicThresholdFilter key="debugMode" onMatch="ACCEPT" onMismatch="DENY"&gt;
                     &lt;KeyValuePair key="true" value="DEBUG"/&gt;                      
                 &lt;/DynamicThresholdFilter&gt;              
             &lt;/filters&gt;               
            &lt;PatternLayout pattern="%d{HH:mm:ss.SSS} [%thread] %-5level [vsTenant] %logger{36} - %msg\n%n" /&gt;
             &lt;Policies&gt;               
                 &lt;SizeBasedTriggeringPolicy size="50 MB" /&gt;              
             &lt;/Policies&gt;            
             &lt;DefaultRolloverStrategy max="5"/&gt;            
         &lt;/RollingFile&gt;       
     &lt;/Appenders&gt;
  
     &lt;Loggers&gt;
         &lt;Root level="ERROR" additivity="false"&gt;
             &lt;AppenderRef ref="console" /&gt; 
             &lt;AppenderRef ref="rollingFile" /&gt;
         &lt;/Root&gt;
     &lt;/Loggers&gt;
  &lt;/Configuration&gt;
  </code></pre>
  
  <p>It is always printing ERROR level. Help is appreciated.</p>