-1

1) I have created a wrapper of log4j2 and used :

    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>2.12.1</version>
    </dependency>

2) Now, In application which consumes it , I have added :

   <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>2.12.1</version>
    </dependency>

3) Another application which is build on point 2, uses logBack to log messages. And it also uses log4j2 to log messages.

When logging from logBack, it is able to log in console, but while logging from log4j2, it throws error of :

A required class was missing while executing LogManager.

What should be done for it?

alpa
  • 5
  • 2
  • Please take the time to do some [research](http://idownvotedbecau.se/noresearch/) and share what you have found **and** why it does not help you. Then make an [attempt](http://idownvotedbecau.se/noattempt/) and post enough [code](http://idownvotedbecau.se/nocode/) to provide an [MCVE](http://idownvotedbecau.se/nomcve/) per the help article [How to Ask a Good Question](http://stackoverflow.com/help/how-to-ask) – D.B. Oct 25 '19 at 04:01

1 Answers1

0
  • Log4j2 is successor of logback. Why are you using both at same time. That might cause issues.
  • Also better to use slf4j logging facade which determines underlying logging backend at runtime. http://www.slf4j.org/
  • Coding against slf4j means you can't use all the features of log4j2. Coding against log4j2 does not mean you're locked into using log4j2 since there is a [bridge to sl4j](https://stackoverflow.com/a/41500347/3284624) – D.B. Oct 25 '19 at 04:00