1
votes

I'm upgrading Log4j-1.2.17 to Log4j2-2.12.2 in my project. To do that I'm using the log4j-1.2 bridge. In old version I use property file to configure log4j.

  1. After upgrade everything looks ok, no errors, no warnings. But logs don't appear in file pointed in properties file. I realized that PropertyConfigurator.class exists in log4j-1.2-api.jar, but methods don't have implementation. empty PropertyConfigurator.configure(Properties properties) Can you explain me that?

  2. Which configuration syntax is correct when I use log4j-1.2-api.jar? log4j or log4j2?

1

1 Answers

1
votes

Prior to Log4j 2.13.0 log4j-1.2-api only provides compatibility for applications that used the log4j 1.x API for logging. The Log4j 2 configuration is still used as all logging calls are redirected to Log4j 2. So only the Log4j 2 configuration syntax would be valid.

Many of the old log4j 1.x internal classes are also present because many applications were using them in an attempt manually manipulate logging, much of which probably isn't necessary with Log4j 2.

In Log4j 2.13.0 the log4j-1.2-api was extended to provide experimental support for Log4j 1.x configuration files. You would have to compare your log4j 1 configurations with the documentation to determine if that support will work for you. However, the Log4j 1.x PropertyConfigurator still will be a no-op even with the compatibility support.