Are you tried to use log(String, Throwable) method ?
Martin Hadis wrote:
> Hello. I'm new to the list and I have a very basic
> question.
>
> I'm having trouble with a servlet and I'd like to see
> its output somewhere.
>
> I've tried both opening a window and writing to a file
> to no avail.
>
> Upon catching an exception inside the servlet, I do
> the following:
>
> try
> {
> FileOutputStream newfile = new
> FileOutputStream("exception.txt");
>
> PrintWriter writer = new PrintWriter(newfile);
> String exceptionString = new String(ex.getMessage());
> writer.println(exceptionString);
> newfile.flush(); newfile.close();
> }
> catch(IOException E)
>
> After running my servlet, it does catch the exception
> generated and the file "exception.txt" is created.
> However the file is empty. Why is this?
>
> How can I output from a servlet to a console or a
> properly-working file?
>
> I'm running NT so my server has not been started from
> a console. I probably need to open my own console
> window.
> I would also welcome any clues as to why the above
> code for outputting the exception string to a file
> does not work.
>
> Please help.
>
> Thanks
>
> -Martin
>
> _____________________________________________________________
> Do You Yahoo!?
> Free instant messaging and more at http://messenger.yahoo.com
>
> ___________________________________________________________________________
> 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