Search code examples
javalog4jlog4j2

Is it worth migrating from log4j1 to log4j2


We are evolving our corporate Java EE infraestructure and are considering a change in our logging platform. We are currently using slf4j as the API and log4j1 as the underlying logging implementation.

Since we don't directly use log4j's API, but sf4j's, it's all a matter of configuration changes, which have already been done.

Our use of the logging system is pretty basic, so we don't need features like log4j2's advance filtering.

Regarding performance, according to the docs, it doesn't seem to be a huge improvement.

So, do you think we should migrate our apps from slf4j+log4j1 to slf4j+log4j2? Why? What advantages do you think it provides?


Solution

  • According to the documentation asynchronuous loggers and appenders seem to improve the performance of Log4J 2 quite drastically: https://logging.apache.org/log4j/2.x/manual/async.html#Performance

    Besides: Log4J 1 is End of Life: https://blogs.apache.org/foundation/entry/apache_logging_services_project_announces

    From the announcement:

    Apache Log4j 2 features a completely rewritten framework. In addition, it is faster, more reliable, and much easier to develop and maintain.

    So, yes, I think it's worth to upgrade.