Using the log4j Package
You may have heard or read about the log4j library from other sources, but in case you haven’t, let’s briefly discuss the library’s history here. Like Struts, log4j is an open source project that is part of the Jakarta set of projects. It’s essentially a set of Java classes and interfaces that provides logging functionality to multiple types of output destinations. It has been around for several years and is constantly being refined and tuned for all types of Java development. In fact, log4j has been so successful that it has been ported to several other very popular languages, including C, C++, Python, and even .NET.
At the time of this writing, log4j has released Version 1.2.8, which is its 22nd major public release. The next major version, 1.3, is in the works, but it won’t be released for a while. Version 1.2 is backward compatible with earlier versions, so if you are using 1.1.3, this material will still be relevant for you.
Recently, the Apache Software Foundation has created a new Apache project called Apache Logging Services. According to the release, the new project is intended to provide “cross-language logging services.” Log4j is a central theme to this project.
According to the creators of log4j, it was built with two central concepts in mind: speed and flexibility. One of the distinctive features of the logging framework is its notion of inheritance in categories, or loggers as they are now called. log4j supports a parent/child relationship ...