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 "Shapira, Yoav" <Yo...@mpi.com> on 2004/09/15 15:56:26 UTC

RE: logging a stack trace

Hi,
Logger.error("Exception: ", e);

Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: Jeff Drew [mailto:jeff@tradingmetrics.com]
>Sent: Wednesday, September 15, 2004 9:57 AM
>To: Log4J Users List
>Subject: logging a stack trace
>
>How do I write a stack trace to a log?
>I found some references in the mail archives, but couldn't find a
solution.
>I couldn't find it in Ceki's book.   Here's a simple example of my
goal.
>Thanks!
>
>public class LogStackTrace {
> static Logger logger = Logger.getLogger("LogStackTrace");
>
> public static void main(String[] args) {
>  BasicConfigurator.configure();
>
>  try {
>   throw new NullPointerException();
>  } catch (Exception e) {
>   e.printStackTrace(); // *** how do I output this to log4j? ***
>   logger.error(e.getStackTrace()); // just writes the object id
>  }
> }
>}
>Jeffrey Drew
>President and Founder
>Trading Metrics, Inc.
>917-453-0302



This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged.  This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender.  Thank you.


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


Re: logging a stack trace

Posted by Jeff Drew <je...@tradingmetrics.com>.
Thanks! This is a huge help!

----- Original Message ----- 
From: "Shapira, Yoav" <Yo...@mpi.com>
To: "Log4J Users List" <lo...@logging.apache.org>
Sent: Wednesday, September 15, 2004 9:56 AM
Subject: RE: logging a stack trace



Hi,
Logger.error("Exception: ", e);

Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: Jeff Drew [mailto:jeff@tradingmetrics.com]
>Sent: Wednesday, September 15, 2004 9:57 AM
>To: Log4J Users List
>Subject: logging a stack trace
>
>How do I write a stack trace to a log?
>I found some references in the mail archives, but couldn't find a
solution.
>I couldn't find it in Ceki's book.   Here's a simple example of my
goal.
>Thanks!
>
>public class LogStackTrace {
> static Logger logger = Logger.getLogger("LogStackTrace");
>
> public static void main(String[] args) {
>  BasicConfigurator.configure();
>
>  try {
>   throw new NullPointerException();
>  } catch (Exception e) {
>   e.printStackTrace(); // *** how do I output this to log4j? ***
>   logger.error(e.getStackTrace()); // just writes the object id
>  }
> }
>}
>Jeffrey Drew
>President and Founder
>Trading Metrics, Inc.
>917-453-0302



This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.


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


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