At 09:08 PM 6/3/2004, Larry Young wrote:
Hello,
I've been struggling with SMTPAppender using the
PatternLayout. No matter what I set the pattern to, it kept sending out
the entire exception stack trace. I thought it was appearing because
of the %m so I thought I was doing the format specifiers incorrectly
(%-1.100m). Come to find out that the SMTPAppender class is taking it
upon itself to append the stack trace to the email message. Actually, it
is only doing this if the Layout class says that it "ignores the
throwable", which PatternLayout does.
So, is my solution to this problem to write a new Layout class
that claims that is doesn't ignore the throwable (which it actually
will!)? I just want to make sure that this is the intended path to go
down to hide the stack trace from the logger output.
It sounds correct. You could actually change PatternLayout, or even the
Layout class to treat ignoresThrowable as a settable property. It's an
interesting use case.
BTW, before anyone thinks I'm throwing away the stack trace, I'm
not. The stack trace is being output to the physical log file. I just
don't want to include it in the email message I'm sending, and I REALLY
don't want to include it in the message I'm sending to my pager!!
Any thoughts or suggestions are appreciated.
--- regards ---
Larry
--
Ceki Gülcü
For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp