logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jung, Eric (Contractor)" <ej...@russellmellon.com>
Subject RE: isDebugEnabled() vs. isErrorEnabled()
Date Fri, 01 Nov 2002 18:34:59 GMT
Yes, Jacob, your philosophy about when debug/info/warn/error/fatal messages
should be used helps clarify things.

I'm wondering why the commons-logging folks didn't follow that same
philosophy. Not that it matters so much, but I recently had to "down-grade"
two applications that wrapped log4j with commons-logging so that they used
log4j directly (i.e., remove commons-logging from the applications).

It required lots of code changes because where log4j only provides
isDebugEnabled() and isInfoEnabled(), commons-logging provides
isXXXEnabled() methods for all predefined priorities.


-----Original Message-----
From: Jacob Kjome [mailto:hoju@visi.com]
Sent: Friday, November 01, 2002 1:28 PM
To: Log4J Users List
Subject: Re: isDebugEnabled() vs. isErrorEnabled()

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
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
JEC> figure it out. Can anyone shed some light on the matter?

JEC> thank you,
JEC> Eric Jung

JEC> --
JEC> To unsubscribe, e-mail:
JEC> For additional commands, e-mail:

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>

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