logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob L. Anawalt" <janaw...@geckosoftware.com>
Subject Re: How to set threshod option for a appender in the configuration file?
Date Mon, 16 Mar 2009 17:49:06 GMT
On 2009-03-13 11:42, Wei, Zhiping wrote:
> Does anybody know what is the correct way to configure threshod for the appender
Threshold is a parameter of any appender inheriting from the 
AppenderSkeleton class. To set a parameter in the xml config you use the 
<param> tag, like this:

<appender name="SOMENAME" class="org.apache.log4j.SomeClass">
  <param name="Threshold" value="WARN" />

I recommend purchasing the log4j manual [0]. It helped me with this and 
other configuration questions.

If you are not using the current log4cxx code but using the old 0.9.7 
version (not recommended), the appender threshold may not work [1]. A 
workaround in that specific case is to use the LevelRangeFilter. Filter 
statements cannot be configured in "Java properties" (key=value) format 
so you have to use the xml file format.

  <filter class="LevelRangeFilter">
    <param name="AcceptOnMatch" value="true" />
    <param name="LevelMin" value="WARN" />
    <param name="LevelMax" value="FATAL" />

[0] https://www.qos.ch/shop/products/log4j/log4j-Manual.jsp
[1] http://archive.netbsd.se/?ml=logging-log4cxx-user&a=2008-02&t=6541111

Jacob Anawalt
Gecko Software, Inc.

View raw message