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,