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 "Dharanendra S. Pandit" <Dh...@netscape.net> on 2002/03/29 08:13:23 UTC

Doubt

Hi *.*,

I'm quite new to log4j.  I'm facing with a problem.  I hope someone 
within the forum might have a solution for this.  The problem is:

When an runtime exception is raised I need to log it into a file, which 
I have already configured.  The logging should be something equivalent 
to e.printStackTrace( ), where e is of type java.lang.Exception.  If  I 
pass object e, to org.apache.log4j.Category.fatal( e ), it looks like it 
is logging e.toString( ), which I do not want.

Is there a way where I could log something equivalent to what 
e.printStackTrace( ) does, into my log file?   Any better ideas of how 
to log Runtime Exceptions would be highly appreciated.

Thanks in advance.


Pandit.


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


Re: Doubt

Posted by max.
All warn, debug, warn, error etc. methods on category/logger can take a
second argument of type throwable. If this is non-null a printstacktrace
will inserted into your logfile

----- Original Message -----
From: "Dharanendra S. Pandit" <Dh...@netscape.net>
To: <lo...@jakarta.apache.org>
Sent: Friday, March 29, 2002 8:13 AM
Subject: Doubt


> Hi *.*,
>
> I'm quite new to log4j.  I'm facing with a problem.  I hope someone
> within the forum might have a solution for this.  The problem is:
>
> When an runtime exception is raised I need to log it into a file, which
> I have already configured.  The logging should be something equivalent
> to e.printStackTrace( ), where e is of type java.lang.Exception.  If  I
> pass object e, to org.apache.log4j.Category.fatal( e ), it looks like it
> is logging e.toString( ), which I do not want.
>
> Is there a way where I could log something equivalent to what
> e.printStackTrace( ) does, into my log file?   Any better ideas of how
> to log Runtime Exceptions would be highly appreciated.
>
> Thanks in advance.
>
>
> Pandit.
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


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