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 Jacques Klein <jk...@dalim.com> on 2002/02/19 17:30:49 UTC

logging stack trace

Very often, it's useful to have with a log message also the stacktrace,
For that purpose, I used to do something like:
      try { throw new SomeException(); } catch(Exception e) {
category.debug("blabla",e); }
Is there anything simpler I could do without the need of an import ....
(a class) ???

Thank's for suggestions....



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: logging stack trace

Posted by Dan Lipofsky <da...@nuserve.com>.
> Very often, it's useful to have with a log message also the stacktrace,
> For that purpose, I used to do something like:
>       try { throw new SomeException(); } catch(Exception e) {
> category.debug("blabla",e); }
> Is there anything simpler I could do without the need of an import ....
> (a class) ???

There is no need to use try/catch, you can just do
    cat.debug("message", new Exception());

- Dan



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>