You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2003/05/22 16:37:43 UTC

DO NOT REPLY [Bug 20150] New: - Exceptions and stack trace

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20150>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20150

Exceptions and stack trace

           Summary: Exceptions and stack trace
           Product: Log4j
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Layout
        AssignedTo: log4j-dev@jakarta.apache.org
        ReportedBy: jkb@stian.freeserve.co.uk


Unlike the Avalon logkit, it appears that log4j does not have the facility to 
print the stack trace from a Throwable passed in the call - log4j only seems to 
print the text of the Throwable.

May I suggest that stack traces are enabled?
I realise that this is perhaps difficult to support in all versions of Java, 
but perhaps it could be supported if the JVM supports it, and ignored otherwise?

If this can be done, may I further suggest:

Adding a dummy throwable to the paraneter list - e.g. log.debug(String,new 
Throwable("dummy")) - would be useful for tracing where functions are called 
from, but it is relatively expensive to create the throwable. One can get round 
this by checking isDebugEnabled() first, but that quickly becomes tedious.

So I suggest new convenience functions debug_e(String), info_e(String) etc 
which autmatically add an internally generated Throwable.

A further enhancement would be to add a set of configuration items to Log4j 
which when set would automatically added an internally generated throwable to 
the relevant calls. e.g. if log4j.debug.trace=true then add a 
throwable/stacktrace to all debug() calls.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-dev-help@jakarta.apache.org