[slf4j-dev] Why no error(Throwable) on the Logger interface?

Jukka Zitting jukka.zitting at gmail.com
Wed May 27 09:48:29 CEST 2009


Hi,

On Wed, May 27, 2009 at 9:36 AM, Robert Elliot <rob at lidalia.org.uk> wrote:
> Just curious about this - I often find myself catching an exception and not
> really having anything to say about it other than that I want to log the
> exception.

I've found that there's always something useful you can (and should)
say in such cases. Even if it's just: "Failed to do X", where "X" is
the stuff inside the try block. Giving even minimal context to the
exception is *really* useful in many cases, especially since many
logging configurations out there don't include stack traces or line
numbers in the log output...

So IMHO having the logging API force you to say at least something
beyond the exception you got is a Really Good Thing (TM).

BR,

Jukka Zitting



More information about the slf4j-dev mailing list