File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Debug in servlet

 
kris reddy
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using apache tomcat for running servlets. I would like my servlet to print out some debug statements when it is executes. I have included some console output statements. I am not sure where to look for the debug output. Where are these debug statements getting printed?
Thanks in advance.
Have a good day,
Kris.
 
Julian Sitkevich
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can look to the console or log, or you can code your own mechanism:

 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on how you've coded your debug statements.

If you use System.out or System.err then both of these are being redirected to the console window (on Windows) and I *think* to catalina_out on *nix.

But how about using the log() method provided by your servlet? This way, it doesn't clutter your console window, and it is accessed by looking at : /CATALINA_HOME/logs/localhost_log.2002-08-29.txt

example:You could also redirect System.err or System.out back to where you wanted... I haven't tried this though, and perhaps there will be permissions trouble with this:
java.lang.System.setOut(PrintStream out)
So you would supply it with a value for 'out' that you want.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic