Return-Path: Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: (qmail 96226 invoked from network); 20 Mar 2008 14:41:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Mar 2008 14:41:35 -0000 Received: (qmail 23481 invoked by uid 500); 20 Mar 2008 14:41:31 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 23461 invoked by uid 500); 20 Mar 2008 14:41:31 -0000 Mailing-List: contact log4j-user-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Users List" Reply-To: "Log4J Users List" Delivered-To: mailing list log4j-user@logging.apache.org Received: (qmail 23450 invoked by uid 99); 20 Mar 2008 14:41:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2008 07:41:31 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [209.86.89.61] (HELO elasmtp-galgo.atl.sa.earthlink.net) (209.86.89.61) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2008 14:40:39 +0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=TFwjjZhfCcmSdkqBeGALzBGJHFpmb6aGtMPsW0zei1lNQCdrSbqBdsm9QIWG2DSd; h=Received:From:Organization:To:Subject:Date:User-Agent:References:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-Disposition:Message-Id:X-ELNK-Trace:X-Originating-IP; Received: from [68.166.17.84] (helo=[192.168.2.102]) by elasmtp-galgo.atl.sa.earthlink.net with esmtpa (Exim 4.67) (envelope-from ) id 1JcLww-0005Lw-J1 for log4j-user@logging.apache.org; Thu, 20 Mar 2008 10:40:59 -0400 From: Tim Watts Organization: Clifton Farm To: log4j-user@logging.apache.org Subject: Re: Suppressing stacktrace output Date: Thu, 20 Mar 2008 10:40:56 -0400 User-Agent: KMail/1.9.5 References: <16145551.post@talk.nabble.com> <16168549.post@talk.nabble.com> <5e87acee0803200215q2fe91e2laad561a6c4e5a28e@mail.gmail.com> In-Reply-To: <5e87acee0803200215q2fe91e2laad561a6c4e5a28e@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200803201040.56494.timtw@earthlink.net> X-ELNK-Trace: 3a5701426d89357f74bf435c0eb9d478b9dabdbb49094eac0cc2009a5caaf3ca5e8e15c62a08e84e350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 68.166.17.84 X-Virus-Checked: Checked by ClamAV on apache.org 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 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: log4j-user-unsubscribe@logging.apache.org > > For additional commands, e-mail: log4j-user-help@logging.apache.org -- "Absolute security comes with chains." --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org