Return-Path: Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: (qmail 51482 invoked from network); 28 Apr 2009 12:35:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 28 Apr 2009 12:35:07 -0000 Received: (qmail 40914 invoked by uid 500); 28 Apr 2009 12:35:06 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 40889 invoked by uid 500); 28 Apr 2009 12:35:06 -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 40878 invoked by uid 99); 28 Apr 2009 12:35:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Apr 2009 12:35:06 +0000 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of Matt.Brown@citrixonline.com designates 216.219.126.165 as permitted sender) Received: from [216.219.126.165] (HELO SBAPEXCH05.ad.corp.expertcity.com) (216.219.126.165) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Apr 2009 12:34:56 +0000 Received: from SBAPEXCH05.ad.corp.expertcity.com ([10.1.6.25]) by sbapexch05 ([10.1.6.25]) with mapi; Tue, 28 Apr 2009 05:34:35 -0700 From: Matt Brown To: Log4J Users List Date: Tue, 28 Apr 2009 05:34:33 -0700 Subject: RE: Log stack trace or simply message option? Thread-Topic: Log stack trace or simply message option? Thread-Index: AcnHaZZVKFlcrP7DRaWIVMmwpB4z2QADN6SAAByq/gAABRoNoA== Message-ID: <44B76DF56DE7A843BB5E8109DC4EEB1204D5AA4934@sbapexch05> References: <8ED21571324EB145933ACCD22B86AC3601E66D2B@bach.ncr.pcigeomatics.com> <44B76DF56DE7A843BB5E8109DC4EEB1204D5AA4733@sbapexch05> <8ED21571324EB145933ACCD22B86AC3601E66DB6@bach.ncr.pcigeomatics.com> In-Reply-To: <8ED21571324EB145933ACCD22B86AC3601E66DB6@bach.ncr.pcigeomatics.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org How are users "seeing" the log output - console output? A file? If it is only the former, then you could simply have the log messages sent = to the console AND a log file as well, in case you need the latter for trou= bleshooting. Sorry if it sounds like I'm dodging your main question - I wouldn't know th= e answer to that so I'm just trying to offer up some other suggestions that= might solve your problem without changing the log4j behavior.=20 -Matt=20 -----Original Message----- From: Steven Keens [mailto:keens@pcigeomatics.com]=20 Sent: Tuesday, April 28, 2009 7:09 AM To: Log4J Users List Subject: RE: Log stack trace or simply message option? Matt, The reason for not wanting the stack trace in "release" mode is because som= e users don't want to see it. As a user I can understand that. As a devel= oper I like to see the stack trace. Adding the option helps both parties. I thought of your solution but that doubles the log events for exceptions w= hen debug is enabled. =20 There is precedence for what I'm asking. The PatternLayout lets me choose = what is written in the log. Why are exceptions special that they must alwa= ys be written? Cheers -- Steven Keens =20 -----Original Message----- From: Matt Brown [mailto:Matt.Brown@citrixOnline.com] Sent: Monday, 27 April, 2009 16:28 To: Log4J Users List Subject: RE: Log stack trace or simply message option? I'm kind of curious why you wouldn't want the stacktrace in "release" mode. Isn't it just as valuable to you then as it is during "debug" mode - perhaps moreso if it is a "release" version of your software? You could just log the exceptions to a different level, one that is not ena= bled in the "release" mode, something like: catch (SomeException e) { log.debug("caught SomeException", e); log.error("caught SomeException"); } And then have the debug level disabled in "release" version. -----Original Message----- From: Steven Keens [mailto:keens@pcigeomatics.com] Sent: Monday, April 27, 2009 2:54 PM To: Log4J Users List Subject: Log stack trace or simply message option? In some places in my code I use the Logger.error(String msg, Throwable t) function to emit log events. When running in "release" mode I'd like to just simply show the log message. When running in "debug" mode I'd like to show the full stack trace. Is there a way to disable logging the stack trace based upon a configuration option? Would I have to write my own code? I did a relatively quick scan through the source and could not find a way to do it. Cheers -- Steven Keens =20 "Duct tape is like the force. It has a light side, a dark side, and it holds the universe together." - Carl Zwanzig =20 PCI Geomatics OGC Technical Representative Phone: 819-770-0022 x204 Fax: 819-770-0098 Email: skeens@pcigeomatics.com Website: www.pcigeomatics.com --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-user-help@logging.apache.org