1) Dump debug information to the Web server's log file with the log() method:
public void log (String msg)
Also, if your servlet throws an exception, your Web server may automatically log the exception.
2) Use a debugger. Most debuggers allow you to debug a servlet but you need to do some extra setup work because the servlet is not a standalone program. In general, you'll need to
I) set the debugger's classpath so that it can find the servlet container class. For example, if you're using IBM VisualAge or the Java Servlet Development Kit, it needs to be able to find the HttpServer Class.
II) set the debugger's classpath so that it can find your servlet's class
III) set breakpoints in your servlet code
IV) run the servlet container class
V) open a Web browser and invoke your servlet
Check your debugger's documentation for more specific instructions on how to debug servlets.
|Last updated 12/26/1999 04:38:20 PM|