[ Team LiB ] Previous Section Next Section


The Workshop is designed to help you review what you have learned and help you further increase your understanding of the material covered in this hour.



How do you obtain access to the log method?


What are some of the advantages of using a formal logging environment such as Log4J?


When setting up a debugger to debug an application, what's the most likely reason you can't see the source code for the application?



The logmethod is available as part of the GenericServlet and HttpServlet classes. It's also available as a method of the ServletContext object available through the application implicit variable.


There are several advantages. Some of them are that you can easily standardize the format, associate additional meaning to a log through the use of a level, and take advantage of the flexibility of the software to produce logs at different destinations.


The source code must be placed in a directory structure that is the same as the corresponding class files. Most developers make the mistake of pointing directly to the source files, instead of pointing to the directory that is the root for the source files. For example, if you're debugging an application that is packaged in com.cde.abc, the source files must be in com/cde/abc and the debugger needs to be set up to look for the source files in the directory containing the subdirectory com.


  1. Modify the Log4J example to use Chainsaw.

  2. Use jdb to run a simple application. Set a breakpoint, examine the source and a variable, and resume the application so that it runs to completion.

  3. Select an IDE, perform the tasks of the last activity using the debugging portion of the IDE.

    [ Team LiB ] Previous Section Next Section