logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Blaine Bergeson (bbergeson)" <bberge...@micron.com>
Subject Add Filter to a Logger
Date Thu, 29 Jan 2015 21:49:25 GMT
How does the DynamicThreshold filter work?  I want to add a filter to the root logger so that
if I add a key to the thread context map it will override the logger level and still pass
it on?  This will allow me to turn up logging on a certain class or set of methods without
having to change the configuration file.

Also, I can see that in general filters can be added to a logger as shown below, but how is
this evaluated?  Normally the loggers' log level is evaluated first, correct?  So if a logging
event is TRACE then the following filter wouldn't even be evaluated, correct?  What if I change
the filter to a DynamicThreshold filter, would it then temporarily override the logger level?

<Loggers>
<Logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
<Filter type="ThreadContextMapFilter">
<KeyValuePair key="test" value="123"/>
</Filter>
<AppenderRef ref="STDOUT"/>
</Logger>
</Loggers>


Thx Blaine

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message