I'm trying to understand how to view System.out output when using Tomcat.
When I start Tomcat, I open a DOS window and run Tomcat's startup.bat file. As a result, stack traces and other output does show up in a DOS window. However, I would like to send all that output to a text file. That will make it much easier to view it and work with it.
The Tomcat docs say:
"Tomcat 5.5 has done away with localhost_log which you may be familiar with as the runtime exception/stack trace log. These types of error are usually thrown by uncaught exceptions, but are still valuable to the developer. They can now be found in the stdout log."
I looked in Tomcat's "logs" dir and throughout the Tomcat hierarchy for a file called "stdout" but there's nothing. The Tomcat docs omit the location and exact filename of "the stdout log".
I did a search on this issue and found the advice to edit catalina.bat to specify where to send stdout. However, looking in catalina.bat, I can't find any code that appears to have anything to do with controlling the destination of stdout.
I also tried using System.setOut() to specify a file for the output stream. No data appeared in the file.
I would appreciate any useful help I can get to resolve this.
That will redirect all output from startup.bat into the my.log file. But this will only work once since it will overwrite the file every time you run tomcat. I think what you have to do is start tomcat as a service. In that case you will use service.bat where you can set up a redirect for stdout.
I haven't a Winders box at my disposal to try it but try adding the '>> logfile.log' to the execute line in catalina.bat.
%_EXECJAVA% ...... %ACTION% >> logfile.log
There's more than one of them.
By the way: If you building anything more than a trivial app, you should really look into a logging package like log4j. It'll make your life a lot easier. [ October 06, 2005: Message edited by: Ben Souther ]