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 
troubleshooting.

Sorry if it sounds like I'm dodging your main question - I wouldn't know the 
answer to that so I'm just trying to offer up some other suggestions that might 
solve your problem without changing the log4j behavior. 

-Matt 

-----Original Message-----
From: Steven Keens [mailto:ke...@pcigeomatics.com] 
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 some 
users don't want to see it.  As a user I can understand that.  As a developer 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 when 
debug is enabled.  

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 always be 
written?

Cheers
--
Steven Keens
 

-----Original Message-----
From: Matt Brown [mailto:matt.br...@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 enabled 
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:ke...@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
 
"Duct tape is like the force. It has a light side, a dark side, and it
holds the universe together."  - Carl Zwanzig
 
PCI Geomatics
OGC Technical Representative
Phone: 819-770-0022 x204
Fax: 819-770-0098
Email: ske...@pcigeomatics.com
Website: www.pcigeomatics.com



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to