title: log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment)
body: <p>I am trying to use log4j2.xml instad of log4j but I keep getting </p>
  
  <pre><code>log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment).
  log4j:WARN Please initialize the log4j system properly.
  </code></pre>
  
  <p>File is located under src/main/resources</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Configuration status="warn" name="WIP"&gt;
    &lt;Appenders&gt;
      &lt;Console name="console" target="SYSTEM_OUT"&gt;
          &lt;PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %MDC{threadTrackId} %40c{1.} - %msg%n"/&gt;
      &lt;/Console&gt;
  &lt;/Appenders&gt;
  &lt;Loggers&gt;
      &lt;Root level="warn"&gt;
          &lt;AppenderRef ref="console"/&gt;
      &lt;/Root&gt;
      &lt;Logger name="com.test" level="debug"/&gt;
      &lt;Logger name="org.springframework" level="info"/&gt;
  &lt;/Loggers&gt;
  &lt;/Configuration&gt;
  </code></pre>
  
  <p>I am not sure if the file is being located correctly but the appenders inside it are not read correctly or the file is not being located.</p>
  
  <p>in My pom file I have the following dependencies </p>
  
  <pre><code>&lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
      &lt;/dependency&gt;
  &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-1.2-api&lt;/artifactId&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>And this is my build section in pom</p>
  
  <pre><code>  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.4.0&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;java&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;configuration&gt;
                  &lt;mainClass&gt;com.wirecard.wip.db.RecreateDatabase&lt;/mainClass&gt;
                  &lt;cleanupDaemonThreads&gt;false&lt;/cleanupDaemonThreads&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>In my class this is how I initialize my logger </p>
  
  <pre><code>private static final Logger LOG =   LoggerFactory.getLogger(MyClass.class);
  </code></pre>
  
  <p>and my imports are </p>
  
  <pre><code>import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  </code></pre>
  
  <p>I run my class through maven using this command</p>
  
  <pre><code>mvn -B -f pom.xml exec:java -Dlog4j.configurationFile=log4j2.xml
  </code></pre>
  
  <p>I also tried </p>
  
  <pre><code>mvn -B -f pom.xml exec:java -Dlog4j.configurationFile=classpath:log4j2.xml
  </code></pre>
  
  <p>Any help is appreciated</p>