How to write Exception output to a file

Discussion in 'Java' started by biswa, Oct 27, 2003.

  1. biswa

    biswa Guest

    Hi,
    I am trying to write Exception to a file instead of writing to Tomcat
    Consol. But i can't find any API that will return me complete Error
    Message. Exception.getMessage() returns me only one line description
    of error message. I want to write Exception.printStackTrace() output
    to file.

    May be i am missing something in docs.

    Please help.
    Thanks.
    biswa.
     
    biswa, Oct 27, 2003
    #1
    1. Advertising

  2. biswa

    Bjorn Abelli Guest

    "biswa" <> skrev i meddelandet
    news:...
    > Hi,
    > I am trying to write Exception to a file instead of
    > writing to Tomcat Consol. But i can't find any API
    > that will return me complete Error Message.
    > Exception.getMessage() returns me only one line
    > description of error message. I want to write
    > Exception.printStackTrace() output to file.


    StackTraceElement[] ste = ex.getStackTrace();

    // Bjorn A
     
    Bjorn Abelli, Oct 27, 2003
    #2
    1. Advertising

  3. biswa schrieb:

    > Hi,
    > I am trying to write Exception to a file instead of writing to Tomcat
    > Consol. But i can't find any API that will return me complete Error
    > Message. Exception.getMessage() returns me only one line description
    > of error message. I want to write Exception.printStackTrace() output
    > to file.
    >
    > May be i am missing something in docs.
    >

    What about
    <http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Throwable.html#printStackTrace(java.io.PrintStream)>

    or

    <http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Throwable.html#printStackTrace(java.io.PrintWriter)>

    Thomas
     
    Thomas Kellerer, Oct 27, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joel Finkel
    Replies:
    1
    Views:
    3,577
    Joel Finkel
    Aug 15, 2003
  2. G
    Replies:
    0
    Views:
    412
  3. G
    Replies:
    2
    Views:
    853
  4. Iulian Ilea
    Replies:
    1
    Views:
    343
    pcx99
    Dec 21, 2006
  5. Tim Chase
    Replies:
    0
    Views:
    107
    Tim Chase
    Dec 16, 2013
Loading...

Share This Page