DEV Community

Cover image for In One Minute : log4j2
Rakesh KR
Rakesh KR

Posted on

In One Minute : log4j2

Apache Log4j 2 is the successor of Log4j 1 which was released as GA version in July 2014.

The framework was rewritten from scratch and has been inspired by existing logging solutions, including Log4j 1 and java.util.logging.

One of the most recognized features of Log4j 2 is the performance of the "Asynchronous Loggers".

The library reduces the need for kernel locking and increases the logging performance by a factor of 12.
For example, in the same environment Log4j 2 can write more than 18,000,000 messages per second, whereas other frameworks like Logback and Log4j 1 just write < 2,000,000 messages per second.

Log4j 2 allows users to define their own log levels.

Log4j can be configured through a configuration file or through Java code.

Configuration files can be written in XML, JSON, YAML, or properties file format.
Within a configuration, you can define three main components: Loggers, Appenders, and Layouts.

Configuring logging via a file has the advantage that logging can be turned on or off without modifying the application that uses Log4j.

Official Website :-

Top comments (0)