How to use log4j2 Commons Logging Bridge

I want to use log4j2 Commons Logging Bridge with shared access 1.2. I tried using something like the following:

import org.apache.logging.log4j.jcl.LogFactoryImpl; public class MyClass{ private static Log log = LogFactoryImpl.getLog(DropinsBundleDeployer.class); . . . log.error("Error occured", e); } 

But when I run the code, I get the following problem and do not see any log:

 log4j:WARN Please initialize the log4j system properly. 

However, the log4j2.xml file is in the class path. How can I use commons logging 1.2 with log4j2 correctly?

+8
java apache-commons logging log4j log4j2
source share
1 answer

You can see the frequently asked questions page on which banks you need .

You will need the following banks on the way to the classes:

  • log4j-api-2.2
  • log4j-core-2.2
  • log4j-jcl-2,2
  • community logging

Also make sure log4j-1.2 is not in your classpath. These error messages look like log4j-1.2 error ...

+11
source share

All Articles