logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Gibbs <simon.gi...@cantorva.com>
Subject Re: How can I write a custom appender to supports Throwable as a second parameter?
Date Mon, 28 Sep 2009 19:50:20 GMT
Alexander Spitzer wrote:
> log4j does not appear to append the stack trace onto the event before
> passing it onto my appender.  Here is a quick test I just did:
>
>     private void init_vars()
>     {
>         forcedLayout=new PatternLayout("%p %c %m");
>         init=true;
>     }
>   
This took me surprise... the clue was that the pattern code was "m" for
message, which didn't seem to cover it.

"The PatternLayout does not handle the throwable contained within
LoggingEvents
<http://www.docjar.com/docs/api/org/apache/log4j/LoggingEvent.html> .
Thus, it returns |true|."

http://www.docjar.com/docs/api/org/apache/log4j/PatternLayout.html#ignoresThrowable

Simon

Mime
View raw message