're-directing" System.err

R

Roy Epperson

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
 
B

Ben_

What about System.setErr() ?

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

Tor Iver Wilhelmsen

Roy Epperson said:
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.
 
A

Andrew

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top