Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > 're-directing" System.err

Reply
Thread Tools

're-directing" System.err

 
 
Roy Epperson
Guest
Posts: n/a
 
      11-08-2003
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


 
Reply With Quote
 
 
 
 
Ben_
Guest
Posts: n/a
 
      11-08-2003
What about System.setErr() ?

Or you may want to use a logging API (Apache log4J or JDK 1.4's Logging API,
for example).


 
Reply With Quote
 
 
 
 
Tor Iver Wilhelmsen
Guest
Posts: n/a
 
      11-08-2003
"Roy Epperson" <(E-Mail Removed)> 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.
 
Reply With Quote
 
Roy Epperson
Guest
Posts: n/a
 
      11-10-2003
Thanks for the pointers. I missed System.setErr() somehow....

"Roy Epperson" <(E-Mail Removed)> wrote in message
news:zpZqb.1959$(E-Mail Removed) k.net...
> 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
>
>



 
Reply With Quote
 
Andrew
Guest
Posts: n/a
 
      11-11-2003
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" <(E-Mail Removed)> wrote in message news:<zpZqb.1959$(E-Mail Removed) nk.net>...
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments