I use this -

    try
    {
        ...
    }
    catch(Exception e)
    {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        e.printStackTrace(pw);
        log(sw.toString());
    }

This logs the stack trace in the error log for that servlet container,

Kevin


-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Xizhen Wang
Sent: 21 October 1999 07:34
To: [EMAIL PROTECTED]
Subject: Re: How to know which line produces the Exception?


What if I am using Servlet and the output is an output stream to the
browser, (which means I cannot see the DOS or Java Console window). Or
how can I redirect the System.out to anther output stream? Or if I use
System.out.println, where does it print? to a log file?

Thank you!

Xizhen

John Weirich wrote:
>
> Like this:
>
>   catch (IOException e) {
>    System.out.println("Problem reading line from input file. " + e);
>    e.printStackTrace();
>   }
>
> -jw
>
> "Mishra, Sunil" wrote:
>
> > print the stack trace in the catch block.
>
> --
> stay fun.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to