log4j permits to enable logging at runtime without modifying the application's binary.
The log4j package is designed so that these statements can remain in shipped code without incurring a heavy performance cost.
Logging behavior can be controlled by editing a configuration file, without touching the application binary.
Logging equips the developer with detailed context for application failures. On the other hand, testing provides quality assurance and confidence in the application. Logging and testing should not be confused.
They are complementary. When logging is wisely used, it can prove to be an essential tool.
One of the distinctive features of log4j is the notion of inheritance in loggers. Using a logger hierarchy it is possible to control which log statements are output at arbitrarily fine granularity but also great ease.
This helps to reduce the volume of logged output and the cost of logging.
What's New in This Release: [ read full changelog ]
· Added interval and modulate options to TimeBasedTriggeringPolicy to allow more fine-grained control of when file rolling should occur.
· Added support for filtering packages from stack traces.
· If system property "disableThreadContextStack" is set pushes to the ThreadContext will be ignored. If system property "disableThreadContext" is set both puts and pushes will be ignored.
· If system property "disableThreadContextMap" is set puts to the ThreadContext
· will be ignored. If system property "disableThreadContext" is set both puts and pushes will be ignored.
· Added support for ANSI colors by adding the highlight and style pattern converters. Fixed pattern parsing to allow nested patterns.
· Allowed the status logging to be directed to stderr or to a file.
· Added getFormats to MultiformatMessage and allow StructuredDataMessage to format as XML.