logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: isDebugEnabled() vs. isErrorEnabled()
Date Fri, 01 Nov 2002 18:28:04 GMT
Hello Eric,

This is because you would usually want warning and fatal messages
being logged whenever they occur.  They are usually encapsulated by a
conditional checking for null value or in a catch clause for when an
exception happens.  These things shouldn't normally happen unless
there is some bad state within your program.  This is much different
than debug and info messages which may be strewn throughout your code
just providing general information on the state of the program...good
or bad.  Because debug and info messages might happen anywhere, it is
useful to have the conditional check to see if info or debug is
enabled.  The info and debug messages still wouldn't be logged if
info and debug were not enabled, but everything within the log message
would be evaluated including string concatenation so the conditional
check provides an important performance increase for your application
when logging is not enabled and doesn't provide much of a hit when it
is enabled.

Does that help?


Friday, November 01, 2002, 11:23:25 AM, you wrote:

JEC> Just curious why there are methods for isDebugEnabled() and isInfoEnabled(),
JEC> but not isWarnEnabled(), isErrorEnabled(), and isFatalEnabled()?

JEC> Commons-logging has methods for all of these.

JEC> I'm sure there must be a good reason (i.e., historical ones), but I can't
JEC> figure it out. Can anyone shed some light on the matter?

JEC> thank you,
JEC> Eric Jung

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

Best regards,
 Jacob                            mailto:hoju@visi.com

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

View raw message