This does the trick for me:

try {
    System.setErr(new PrintStream(new FileOutputStream("log")));
} catch (FileNotFoundException e) {
    System.out.println(e);
}

Handy for when those exception errors are many screens long.

----- Original Message -----
From: "Rakesh Arora" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 01 March 2000 06:11
Subject: Re: Redirecting System.err.print to a file


> Hi
>
> You can do one thing to direct all messages to one file.
> Just open one file right at the start of your application
> and the write a function ,which takes a string as a parameter and writes
> this string into
> file you have opened.
> then u can replace all ur system.err.println with calling of this
function.
> this way all statements wud appear in ur log file.
>
> Rakesh
>
> -----Original Message-----
> From: Thangamani RATHINAM [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 28, 2000 06:33 AM
> To: [EMAIL PROTECTED]
> Subject: Redirecting System.err.print to a file
>
>
> Hello everyone
>
> I am running JWS2.0 under NT. I want to redirect System.err.print messages
> to a log file.  Is it possible? Has any one done this before? or Is there
> any other way to generate user defined log files?
>
> Any help or pointer in this regard would be much appreciated.
>
> Thanks in advance.
>
> Best Regards
> Tango
>
>
___________________________________________________________________________
> 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
>

___________________________________________________________________________
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