The Dining.Name Web application uses Log4J, Apache's logging library for Java, to log the behavior of classes that import XML data into a MySQL database.
Log4J is a simple class library -- the basics take no more than a half-hour to learn, as I described in a Linux Magazine article in 2002. It supports four levels of logging and external configuration. Right now, I'm building Dining.Name at debug level and getting verbose output. When I'm confident that it works, I'll change it to fatal level by tweaking a properties file and only see crash details.
One thing I needed Log4J to do was include a stack trace with fatal exceptions. The printStackTrace() method can't be used because it displays on standard output. As I discovered in a manual on Red Hat's Web application framework, including a stack trace is easy: Log the exception object instead of a string. The exception's message and stack trace will be logged automatically.
