You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Hein Meling <me...@item.ntnu.no> on 2002/07/30 21:47:55 UTC
feature request: logging a stack trace
hi.
sorry if this is not the right place for this kind of request, but i
don't want to subscribe to the developers list.
anyway, sometimes it may be very useful to log a stack trace, even if
there was no exception, in order to determine from where a method is
being called. is this idea something that could be interesting to add
to the Logger (or Category) class in Log4j? That is a method like:
logStackTrace(), or whatever...
my implementation (residing in a class called Debug) is very rough so,
it needs a bit of cleaning up to fit well into log4j:
public static void logStackTrace(org.apache.log4j.Logger log)
{
try {
throw new Exception();
} catch (Exception e) {
StringWriter swriter = new StringWriter();
e.printStackTrace(new PrintWriter(swriter));
log.debug(swriter.toString());
}
}
comments?
ciao,
- hein
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>