2 messages in org.apache.logging.log4j-userRe: SMTPAppender logging stacktrace
FromSent OnAttachments
Larry YoungJun 3, 2004 12:07 pm 
Ceki GülcüJun 3, 2004 2:14 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: SMTPAppender logging stacktraceActions...
From:Ceki Gülcü (ce@qos.ch)
Date:Jun 3, 2004 2:14:45 pm
List:org.apache.logging.log4j-user

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