OR subclass PatternLayout and add a setIgnoresThrowable(). Then use this subclass in your console appender definition and add a property to disable:
... log4j.appender.console.layout=com.mydomain.MyPatternLayout log4j.appender.console.layout.IgnoresThrowable=false ... (or whatever the XML equivalent is) This approach would allow you to apply this behaviour to other appenders if you wanted to later. On Thursday 20 March 2008 5:15 am, Maarten Bosteels wrote: > see > http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Layout.html#ig >noresThrowable() > > "If the layout handles the throwable object contained within LoggingEvent, > then the layout should return false. Otherwise, if the layout ignores > throwable object, then the layout should return true. The SimpleLayout, > TTCCLayout, PatternLayout all return true. The XMLLayout returns false." > > For appenders that extend WriterAppender, the stacktrace will be appended > by the WriterAppender > when the layout ignores the throwable. > > see > http://logging.apache.org/log4j/1.2/xref/org/apache/log4j/WriterAppender.ht >ml#300 > > So I guess you could extend ConsoleAppender and override subAppend. > > regards, > Maarten > > On Thu, Mar 20, 2008 at 1:26 AM, jimski <[EMAIL PROTECTED]> wrote: > > Hi James- > > > > > > I think the layout determines if the stack trace is logged. How are > > you configuring the console appender? > > > > > > I thought so too. But it doesn't seem that's the case. I'm using the > > following pattern: > > > > [%d{yyyy-MM-dd HH:mm:ss}] %-5p %m %n > > > > so I expect only a date, the level, the message and a newline character. > > > > -- > > View this message in context: > > http://www.nabble.com/Suppressing-stacktrace-output-tp16145551p16168549.h > >tml Sent from the Log4j - Users mailing list archive at Nabble.com. > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] -- "Absolute security comes with chains." --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]