You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Mark Howard <ma...@1spatial.com> on 2007/02/15 12:06:37 UTC

Chained Exception Logging

Hi,

I'm a little confused about the Logger.error(msg, throwable) method.

I'm trying to log an exception at a high level, so I'm calling
logger.error("message", exception), where exception is part of a chain
of multiple exceptions.
When the log level is set to debug, the full trace of the exception is
logged, including all chained exceptions. When setting the log level
to info, the message is logged and possibly the toString of the
exception, but nothing else is logged. So all information about the
chained exceptions is lost.
Is there any way to log the chained exceptions too, as is done when
the log level is set to debug? or possibly just print the message of
each chained exception and not the full stack trace?

It is often noted that logging each message as you catch and wrap is
bad practice, so why doesn't the logger give details of the chained
exceptions?

Thank you in advance for teaching me how to use log4j.

Regards,

Mark Howard


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org