how are the lower level debugs handled?
1 posts in topic
Flat View  Flat View

Posted By:   Joost_Schouten
Posted On:   Monday, November 25, 2002 05:42 AM


If my logging level is set to INFO, what does the logger do with the DEBUG loggings? Does it totally ignore them? Or does it still waste time with running through the methods used to create the message. I use a couple of timeconsuming bean.doRender() methods.



Re: how are the lower level debugs handled?

Posted By:   Christopher_Schultz  
Posted On:   Monday, November 25, 2002 12:23 PM

This depends on several things. Here's what happens when your log message is executed:

First, the VM executes all the code included in your call to logger.(). That includes strint concatenation, etc. that is done to build the complete argument list to send to the method. If you want to avoid this, say, in a debug situation, you can always use logger.isDebugEnabled() to predicate the logger call, which will avoid this extra stuff.

Next, the Logger object checks to see if the message priority (or level, they've changed the names recently) is at or above that of the current logger. So, if you're processing a DEBUG message, but the logger is set to INFO, then this message will be discarded (won't go to any appenders). If the message is above the appropriate threshold, then every appender associated with that logger (and any of its parent loggers, unless its additivity is set to false) will be invoked with that message.

Finally, each appender checks the log level against the threshold of the appender and only if the level of the message is at or above that of the appender is it emitted by that appender.

Hope that helps,

About | Sitemap | Contact