Very basic question. I'm attempting to diagnose what is happening in a servlet. My usual way would be to put in an IDE and walkthrough the code debugger. Not an option this time. The other course of action that I take is just to put System.out.println("whatever") to indicate location and status of some variables. Where does that print in the case of a servlet? I'm using Orion and I'm not seeing the servlet container produce the diagnostic message, which is what I expected. Thanks!
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12266
1
posted
0
Servlet containers typically redirect System.out and System.err to log files - surely it is in the documentation somewhere. You can get the full text of the debugging chapter from my servlet/JSP book at: http://www.lanw.com/books/servletjsp/default.htm Basic rules: Never throw away the information in an exception, make helper classes that can be debugged offline.
Many IDEs CAN debug servlets, including WebGain's Visual Cafe and Sun's Forte (which actually starts up a copy of Tomcat). I'd be very suprised if IBM's Visual Age isn't included, and I'm also pretty sure Borland's IDE does so too. However, println works too - I've used it with Tomcat and WebLogic. I'm reasonably certain that if you dig, you'll find that Orion has some special place where stdout and stderr println's go too. You can also use the servlet log() method - which is really what you ought to be using for any production code so it shows up in whatever official logging facilities you're using.
Customer surveys are for companies who didn't pay proper attention to begin with.
Juan Zhang
Greenhorn
Joined: Apr 19, 2001
Posts: 13
posted
0
I use JOptionPane.showMessageDialog(null,"check variable") to diagnose what is happening in servlet and JSP. It works for me, but I don't know if it is the right way. Juan