title: Spring boot: ERROR StatusLogger Log4j2 could not find a logging implementation
body: <p>I trying to add log4j2 to spring boot project but it is giving below error.
  ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console</p>
  
  <p>I have configured same using this link
  <a href="https://howtodoinjava.com/spring-boot2/spring-boot-log4j2-config/" rel="nofollow noreferrer">https://howtodoinjava.com/spring-boot2/spring-boot-log4j2-config/</a></p>
  
  <pre class="lang-java prettyprint-override"><code>package log.demo.LogDemo;
  
  /**
   * Hello world!
   *
   */
  import org.apache.logging.log4j.LogManager;
  import org.apache.logging.log4j.Logger;
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
  import org.springframework.context.ApplicationContext;
  
  @SpringBootApplication
  public class Application extends SpringBootServletInitializer {
  
  
      private static final Logger LOGGER = LogManager.getRootLogger();//Application.class);
  
      public static void main(String[] args)
      {
  
          ApplicationContext ctx = SpringApplication.run(Application.class, args);
  
          LOGGER.info("Info level log message");
          LOGGER.debug("Debug level log message");
          LOGGER.error("Error level log message");
      }
  }
  </code></pre>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;log.demo&lt;/groupId&gt;
      &lt;artifactId&gt;LogDemo&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;LogDemo&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&gt;
  
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.1.3.RELEASE&lt;/version&gt;
      &lt;/parent&gt;
  
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                      &lt;artifactId&gt;spring-boot-starter-logging&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-log4j2&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
  
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
          &lt;resources&gt;
              &lt;resource&gt;
                  &lt;directory&gt;src/main/resources&lt;/directory&gt;
                  &lt;excludes&gt;
                      &lt;!-- &lt;exclude&gt;application.properties&lt;/exclude&gt; &lt;exclude&gt;TahitiConfig.xml&lt;/exclude&gt; 
                          &lt;exclude&gt;job_definitions.xml&lt;/exclude&gt; --&gt;
                  &lt;/excludes&gt;
              &lt;/resource&gt;
          &lt;/resources&gt;
  
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Don't understand what went wrong any help will be great.
  Please let me know if required more information</p>
  
  <p>Tried this solution but no help
  <a href="https://stackoverflow.com/questions/39560740/log4j2-could-not-find-a-logging-implementation-with-sprint-boot">Log4j2 could not find a logging implementation with Sprint Boot</a></p>