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: modifying log levels through a management console
Date Tue, 05 Jun 2001 19:28:15 GMT
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: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>

--
Ceki Gülcü


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Mime
View raw message