Java logging 2.0: Log4j undergoes major upgrade

Old developer faithful now offers next-generation Asynchronous Loggers, auto-extension detection, and support for properties.

After being teased with the first release
candidate five months ago, Log4j users are celebrating that the
major release of Apache Log4j 2.0 has finally gone
live. The Java logging
framework, launched in 1996 as an EU Semper project, has undergone
a number of revisions in its second major version, as theRelease Notesshow.

The headline news is that the API for Log4j is
separate from the implementation, making it clear for application
developers which classes and methods they can use while ensuring
forward compatibility. According to the Log4j team, this helps them
to improve the implementation in a safe and compatible
fashion.

Log4j 2.0 is chock-a-block with next-generation
Asynchronous Loggers, based on the LMAX Disruptor library. This
means that, in multi-threaded scenarios, Asynchronous Loggers have
“10 times higher throughput and orders of magnitude lower latency
than Log4j 1.x and Logback.” Otherwise, Log4j 2
performs faster than Log4j 1.x in critical areas and similarly to
Logback under most circumstances.

Thanks Log4js plug-in architecture. extensions
of the framework are automatically detected and included when
plug-ins are referenced in the configuration.

Also new is that properties are supported , ie
properties of defined values ​​from the configuration file, the
system properties, environment variables, the
Thread ContextMap and data from the log event.
Using a lookup plug-ins can be configured individually with
PropertyProvider.

Log4j 2.0 requires Java 6 or later versions of
the language, and is not compatible with Log4j 1.x. . However,
adapters for older APIs are available, as well as for Commons
Logging and SLF4J. Log4j is under Apache 2.0 license and may differ
from the correspondingdownload
pagerelated to the Apache Foundation.

Already almost two years ago, there was reason
to believe that version 2.0 of the Log4j software would frame a
dramatic “Comeback
of the Year” narrative for the technology. “What
year?” would, in retrospect, have been quite legitimate question,
with certain Twitterati scoffing that release is around a decade
overdue. But it was all well worth the wait – and Logj4 2.0 is all
the more impressive an achievement when you consider the sheer
perseverance required from the project team to make sure it all
came together in the end.