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.additivity.com.idika.TestLogger=false
>#log4j.appender.com.idika.TestLogger.Additivity=false
>log4j.appender.Second=org.apache.log4j.FileAppender
>log4j.appender.Second.File =Info.txt
>log4j.appender.Second.layout=org.apache.log4j.PatternLayout
>log4j.appender.Second.layout.ConversionPattern=%d %p %r [%t] %c - %m%n
> 
>log4j.appender.Second.filter=org.apache.log4j.varia.PriorityMatchFilter
>log4j.appender.Second.filter.PriorityToMatch=INFO
>log4j.appender.Second.filter.AcceptOnMatch=true

----
Ceki Gülcü          Web:   http://qos.ch      
av. de Rumine 5     email: [EMAIL PROTECTED] (preferred)
CH-1005 Lausanne           [EMAIL PROTECTED]
Switzerland         Tel: ++41 21 351 23 15


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to