title: How to configure Spring 3 with SLF4J over LOG4J2 using Log4jConfigurer?
body: <p>I am trying to configure my application to use SLF4J with log4j2 for logging. 
  The application uses Spring 3. The console logger is working but none of the Rolling appenders seems to be logging anything.</p>
  
  <p>Here is how application logging is configured :</p>
  
  <ul>
  <li><p>pom.xml</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-aop&lt;/artifactId&gt;
      &lt;version&gt;3.2.18.RELEASE&lt;/version&gt;
      &lt;type&gt;jar&lt;/type&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
      &lt;version&gt;3.2.18.RELEASE&lt;/version&gt;
      &lt;type&gt;jar&lt;/type&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
      &lt;exclusions&gt;
          &lt;exclusion&gt;
              &lt;groupId&gt;commons-logging&lt;/groupId&gt;
              &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
          &lt;/exclusion&gt;
      &lt;/exclusions&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
      &lt;artifactId&gt;log4j-api&lt;/artifactId&gt;
      &lt;version&gt;2.11.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
      &lt;artifactId&gt;log4j-core&lt;/artifactId&gt;
      &lt;version&gt;2.11.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
      &lt;artifactId&gt;log4j-slf4j-impl&lt;/artifactId&gt;
      &lt;version&gt;2.11.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
  </code></pre></li>
  <li><p>web.xml</p>
  
  <pre><code>&lt;listener&gt;
         &lt;listener-class&gt;
             org.springframework.web.util.Log4jConfigListener
         &lt;/listener-class&gt;
  &lt;/listener&gt;
  </code></pre></li>
  <li><p>Application.xml
  <br/><br/></p></li>
  </ul>
  
  <p>log4j properties :</p>
  
  <pre><code>    log4j.rootLogger=DEBUG, CONSOLE
  
  log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
  log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
  log4j.appender.CONSOLE.layout.ConversionPattern=[%d{ISO8601} EST] %X{sessionId} %X{requestTokenId} %X{clientIP} %p %m%n
  
  log4j.appender.TEST_APPENDER=org.apache.log4j.RollingFileAppender
  log4j.appender.TEST_APPENDER.File=a.log
  log4j.appender.TEST_APPENDER.MaxFileSize=10MB
  log4j.appender.TEST_APPENDER.layout=org.apache.log4j.PatternLayout
  log4j.appender.TEST_APPENDER.layout.ConversionPattern=[%d{ISO8601} EST] %X{sessionId} %X{requestTokenId} %X{clientIP} %p %m%n
  log4j.appender.TEST_APPENDER.MaxBackupIndex=8
  log4j.appender.TEST_APPENDER.Threshold=DEBUG
  
  log4j.logger.com.abhishek=DEBUG, CONSOLE, TEST_APPENDER
  </code></pre>
  
  <p>application xml :</p>
  
  <pre><code>&lt;bean id="log4jInitialization" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"&gt;
          &lt;property name="targetClass" value="org.springframework.util.Log4jConfigurer" /&gt;
          &lt;property name="targetMethod" value="initLogging" /&gt;
          &lt;property name="arguments"&gt;
              &lt;list&gt;
                  &lt;value&gt;${config.dir}/log4j.properties&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>logging code :</p>
  
  <pre><code>import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  private static final Logger LOGGER = LoggerFactory.getLogger(Test.class);
  LOGGER.debug("Testing...");
  </code></pre>