're-directing" System.err

Discussion in 'Java' started by Roy Epperson, Nov 8, 2003.

  1. Roy Epperson

    Roy Epperson Guest

    I've written a GUI application that might throw un-handled exceptions when
    users are using it in some modes. The application is started by a separate
    executable so there is no command line/window for System.err to show up in.

    Is there a way to re-direct System.err so any exceptions get logged to a
    file, say in user.home?

    TIA,
    Roy
    Roy Epperson, Nov 8, 2003
    #1
    1. Advertising

  2. Roy Epperson

    Ben_ Guest

    What about System.setErr() ?

    Or you may want to use a logging API (Apache log4J or JDK 1.4's Logging API,
    for example).
    Ben_, Nov 8, 2003
    #2
    1. Advertising

  3. "Roy Epperson" <> writes:

    > Is there a way to re-direct System.err so any exceptions get logged to a
    > file, say in user.home?


    Use System.setErr() on a stream to that file.
    Tor Iver Wilhelmsen, Nov 8, 2003
    #3
  4. Roy Epperson

    Roy Epperson Guest

    Thanks for the pointers. I missed System.setErr() somehow....

    "Roy Epperson" <> wrote in message
    news:zpZqb.1959$...
    > I've written a GUI application that might throw un-handled exceptions when
    > users are using it in some modes. The application is started by a

    separate
    > executable so there is no command line/window for System.err to show up

    in.
    >
    > Is there a way to re-direct System.err so any exceptions get logged to a
    > file, say in user.home?
    >
    > TIA,
    > Roy
    >
    >
    Roy Epperson, Nov 10, 2003
    #4
  5. Roy Epperson

    Andrew Guest

    You use the System.setErr( PrintStream ) method. Consult the API
    documentation on how to create a java.io.PrintStream object and
    redirect its output to a log file.

    I will probably regret replying to this post. The last time I replied
    to a Usenet post I recieved spam and trojan-laden email for about a
    week. Oh, well. I guess I'll deal with it.

    "Roy Epperson" <> wrote in message news:<zpZqb.1959$>...
    > I've written a GUI application that might throw un-handled exceptions when
    > users are using it in some modes. The application is started by a separate
    > executable so there is no command line/window for System.err to show up in.
    >
    > Is there a way to re-direct System.err so any exceptions get logged to a
    > file, say in user.home?
    >
    > TIA,
    > Roy
    Andrew, Nov 11, 2003
    #5
    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. Terry Cooper
    Replies:
    7
    Views:
    420
    Janos Sebok
    Jun 9, 2009
  2. Murugesh

    directing output of system()

    Murugesh, Mar 23, 2005, in forum: Perl Misc
    Replies:
    9
    Views:
    114
    J├╝rgen Exner
    Mar 24, 2005
  3. Replies:
    1
    Views:
    556
  4. Replies:
    1
    Views:
    418
    Roedy Green
    Aug 29, 2012
  5. Replies:
    0
    Views:
    340
Loading...

Share This Page