Log4j 2 Features

Log4j is the leading Java logging framework released a decade ago. The study shows that there is 4 percent of the total code is related to the logging messages. This gives the impression that a better logging framework is always good for a project performance. Log4j’s last major version 1.0 has been released couple of years back and there is not much development for the long period of time.

To break the silence, Log4j team has announced the next major release Log4j 2.0 with promising features. At present it is in the Release Candidate 1 stage. However, it is expected to be released to the public in the near future. This blog post highlights the notable changes and features that are part of the upcoming Log4j version.

Log4j 2 Features

  • The new log4j API will not be compatible with the older version. If you are running older version in your project, you can download the log4j adopter and then install the log4j2. It is officially supported.
  • The minimum Java version is 1.6.
  • The configuration options are done as XML or JSON formats. Since the first release, log4j more emphasize on the properties files, now it go away with properties and supports the industry standards.
  • Configuration formats are changes. The configuration file name will be log4j2.xml or log4j2.json. Also there is a defined order of checking the configuration initialization.
  • Plugin architecture is supported. Developer can write their own modules and extend the log4j functionality.
  • One of the most powerful feature is automatic re-loading of the configuration files. Not only that, when it re-loads it won’t loose the logging events at the time of re-loading.
  • Log4j2 supports the integration with other logging frameworks like slf4j and Commons logging API.
  • Like Logback, Log4j 2 supports filtering based on context data, markers, regular expressions, and other components in the Log event.
  • Log4j 2 “just works” in Servlet 3.0 and newer web applications. It is capable of automatically starting when the application deploys and shutting down when the application undeploys.
  • Note that Log4j 2 does not support Servlet 2.4 and older web applications.

If you are interested in reading more information on the log4j2, you can look at their official website or keep reading in our blog for more informative articles about log4j.

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Share This

Share this post with your friends!