logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <...@qos.ch>
Subject Re: Filtering messages
Date Sun, 04 Mar 2001 21:28:45 GMT

Have you looked at the Threshold property in AppenderSkeleton?

This is from the log4j FAQ:

Is it possible to direct log output to different appenders by priority?

Yes it is. Setting the Threshold option of any appender extending AppenderSkeleton, (most
log4j appenders extend AppenderSkeleton) to filter out all log events with lower priority
than the value of the threshold option. 

For example, setting the threshold of an appender to DEBUG also allow INFO, WARN, ERROR and
FATAL messages to log along with DEBUG messages. (DEBUG is the lowest priority). This is usually
acceptable as there is little use for DEBUG messages without the surrounding INFO, WARN, ERROR
and FATAL messages. Similarly, setting the threshold of an appender to ERROR will filter out
DEBUG, INFO and ERROR messages but not FATAL messages. 

This policy usually best encapsulates what the user actually wants to do, as opposed to her
mind-projected solution. 

See sort4.lcf for an example threshold configuration. 

I hope this anwers the question. Ceki

At 14:20 02.03.2001 +0530, jayan wrote:
>Jim , my aim is to segregate INFO messages to Info.txt,but it is logging all messages
below INFO priority...
>filtering of INFO,WARN,FATAL,ERROR  using  PropertyConfigurator is possible 
>or do i need to use DOMConfigurator and XML property file
>My property file is this
>log4j.category.com.idika.TestLogger=INFO, Second
>log4j.appender.Second.File =Info.txt
>log4j.appender.Second.layout.ConversionPattern=%d %p %r [%t] %c - %m%n

Ceki Gülcü          Web:   http://qos.ch      
av. de Rumine 5     email: cgu@qos.ch (preferred)
CH-1005 Lausanne           ceki_gulcu@yahoo.com
Switzerland         Tel: ++41 21 351 23 15

View raw message