At 10:52 05.06.2001 -0700, you wrote:
>Mark Masterson wrote:
>
>>In your example, the easiest way to achieve what you're after is to use the
>>"Threshold" parameter, common to all Appenders, and set its priority as
>>appropriate.  
>
>
>Is it more performant to set the log level via the Appender or via Categories? Here's 
>my example...
>
>log4j.rootCategory=WARN,A1
>
>log4j.category.com.filefish.test=DEBUG
>log4j.category.com.filefish.bar=WARN,A2
>
>log4j.appender.A1=org.apache.log4j.ConsoleAppender
>
>log4j.appender.A2=org.apache.log4j.net.SyslogAppender
>log4j.appender.A2.Threshold=DEBUG
>
>All test category messages sent to A1 and all messages sent to A2 both get logged at 
>all levels. Is there anything saved by having the category check, as opposed to 
>sending the message to the appender to be checked there as well?

Yes, performance hit is very significant. Filtering at the appender level involves the 
following extra steps:

1) creation of a LoggingEvent,
2) its  initialization, 
3) a search for appenders from the hierarchy
4) synchronized call to the doAppend method of the appenders
5) return from the doAppend method after the Threshold check

My guess would be a performance factor of at least 10 but probably 100. 

You don't want to do appender filtering if you can get away with category filtering. 
Regards, Ceki








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

--
Ceki Gülcü


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

Reply via email to