commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ola Berg <>
Subject Re: [logging] are there standard logging practices?
Date Thu, 25 Jul 2002 10:15:41 GMT
>I\'ve tended to *not* log exceptions thrown at the component level --
>especially deliberate ones like a documented IllegalArgumentException for
>invalid method parameters, 

My 2 cents:

I usually log the exception at the point where it is
swallowed/handled. If i resend it depends on the severity of the error and the log level.
Some common cases includes:

1) Rethrow exception and log a WARN, stating the consequences (\"WARN: SomeKindOfException
at line 123: process continues in fallback-mode\").

2) Rethrow exception and log a DEBUG or INFO, just for the sake of it (this just happened

3) Swallow/Handle exception and log an ERROR. Often I log the ERROR, stating what went wrong,
and immediately a WARN stating the consequences as in 1).

4) Just let the exception bubble up to some \"top\" (of application or component or subsystem)
and log a FATAL.

In general:

a) it is less inconvenient to log and rethrow exceptions at the more detailed logger level.
When you want a detailed logger level, you want to see where and when things happens.

b) it is a good thing to inform people at different levels of the component containment hierarchy
what the exception means to that particular level, as the exception bubbles up the stack.
One does not have to log the very exception at that level, just inform about the consequences.


0733 - 99 99 17

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

View raw message