Log4j 1.2 Bridge

The Log4j 1.2 Bridge allows applications coded to use Log4j 1.2 API to use Log4j 2 instead.


The Log4j 1.2 bridge is dependent on the Log4j 2 API. The following Log4j 1.x methods will behave differently when the Log4j 2 Core module is included then when it is not:

MethodWithout log4j-coreWith log4j-core
Category.getParent()Returns nullReturns parent logger
Category.setLevel()NoOpSets Logger Level
Category.setPriority()NoOpSets Logger Level
Category.getAdditivity()Returns falseReturns Logger’s additivity setting
Category.setAdditivity()NoOpSets additivity of LoggerConfig
Category.getResourceBundle()NoOpReturns the resource bundle associated with the Logger
BasicConfigurator.configure()NoOpReconfigures Log4j 2

If log4j-core is not present location information will not be accurate in calls using the Log4j 1.2 API. The config package which attempts tp convert Log4j 1.x configurations to Log4j 2 is not supported without Log4j 2.

For more information, see Runtime Dependencies.


To use the Log4j Legacy Bridge just remove all the Log4j 1.x jars from the application and replace them with the bridge jar. Once in place all logging that uses Log4j 1.x will be routed to Log4j 2. However, applications that attempt to modify legacy Log4j by adding Appenders, Filters, etc may experience problems if they try to verify the success of these actions as these methods are largely no-ops.