How to use log4j2 Commons Logging Bridge

11,944

You may want to look at the FAQ page on which jars you need.

You will need the following jars on the classpath:

  • log4j-api-2.2
  • log4j-core-2.2
  • log4j-jcl-2.2
  • commons logging

Also please ensure that log4j-1.2 is not in your classpath. That error messages looks like a log4j-1.2 error...

Share:
11,944
Grant
Author by

Grant

Student. Like to programming and just started Android programming. Still learning by my own and with your help. :)

Updated on June 04, 2022

Comments

  • Grant
    Grant almost 2 years

    I want to use log4j2 Commons Logging Bridge with commons 1.2. I tried to use something like follows:

    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'm running the code I'm getting following issue and cannot see any log:

    log4j:WARN Please initialize the log4j system properly.
    

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