Try using the servlet runner. If an exception is thrown, it will be
thrown into the console that the servletrunner is running in. You can
also use System.out.println() to help try and debug your servlet, and it
will also be printed to that console. If a console is not a possibility,
then you could always create a global variable that contains the response
output stream and write debugging information to the browser, and if I
remember correctly, the exception to the browser as well. I hope this
helps. If you need any more hints, let me know.
On Fri, 14 May 1999, 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
>
Talk to you later,
Larry M. Lemons
http://php.indiana.edu/~llemons/home.html
Live your life as a tale to be told..
always make the more interesting choice.
___________________________________________________________________________
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