title: Tomcat 7 records all logs into catalina.out but not into log4j2 defined files
body: <p>Before converting my application into the web app. Log4j was recording logs in the correct log files (info.log and debug.log) which I've defined in the <strong>log4j2.xml</strong>.</p>
  
  <p>But when I've changed my application to web.app, all logs now records into the <strong>catalina.out</strong> file in the servlet container (<strong>tomcat 7</strong>).
  After deploying application log4j2 creates these log file, but they remain empty and all logs goes to catalina.out file.</p>
  
  <p>Could you suggest what I am doing wrong.</p>
  
  <p>In <strong>web.xml</strong>, I've added necessary configuration.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
      &lt;display-name&gt;project-service&lt;/display-name&gt;
  
      &lt;!-- Support for Spring --&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;classpath*:applicationContext.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;log4jConfiguration&lt;/param-name&gt;
          &lt;param-value&gt;log4j2.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;
              org.springframework.web.context.ContextLoaderListener
          &lt;/listener-class&gt;
      &lt;/listener&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;
              org.springframework.web.util.Log4jConfigListener
          &lt;/listener-class&gt;
      &lt;/listener&gt;
  
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p><strong>log4j2.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Configuration status="trace" strict="true" name="XMLConfigTest"
                 packages=""&gt;         
  
      &lt;Appenders&gt;
          &lt;Console name="Console" target="SYSTEM_OUT"&gt;
              &lt;PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/&gt;
          &lt;/Console&gt;
  
          &lt;RollingRandomAccessFile name="RollingRandomAccessFileDebug" fileName="/local/deploy/logs/debug.log"
                                   filePattern="logs/$${date:yyyy-MM}/project-%d{MM-dd-yyyy}-%i.log.gz"
                                   immediateFlush="false"
                                   append="false"&gt;
              &lt;PatternLayout&gt;
                  &lt;Pattern&gt;%d %p %c{1.} [%t] %m%n&lt;/Pattern&gt;
              &lt;/PatternLayout&gt;
              &lt;Policies&gt;
                  &lt;TimeBasedTriggeringPolicy/&gt;
                  &lt;SizeBasedTriggeringPolicy size="250 MB"/&gt;
              &lt;/Policies&gt;
          &lt;/RollingRandomAccessFile&gt;
          &lt;RollingRandomAccessFile name="RollingRandomAccessFile" fileName="/local/deploy/logs/info.log"
                                   filePattern="logs/$${date:yyyy-MM}/project-%d{MM-dd-yyyy}-%i.log.gz"
                                   immediateFlush="false"
                                   append="false"&gt;
              &lt;PatternLayout&gt;
                  &lt;Pattern&gt;%d %p %c{1.} [%t] %m%n&lt;/Pattern&gt;
              &lt;/PatternLayout&gt;
              &lt;Policies&gt;
                  &lt;TimeBasedTriggeringPolicy/&gt;
                  &lt;SizeBasedTriggeringPolicy size="250 MB"/&gt;
              &lt;/Policies&gt;
          &lt;/RollingRandomAccessFile&gt;
          &lt;!--&lt;Async name="AsyncConsole"&gt;--&gt;
          &lt;!--&lt;AppenderRef ref="Console"/&gt;--&gt;
          &lt;!--&lt;/Async&gt;--&gt;
      &lt;/Appenders&gt;
      &lt;Loggers&gt;
          &lt;Root  level="TRACE"&gt;
              &lt;AppenderRef ref="RollingRandomAccessFileDebug" level="DEBUG"/&gt;
              &lt;AppenderRef ref="RollingRandomAccessFile" level="INFO"/&gt;
              &lt;AppenderRef ref="Console"  level="TRACE"/&gt;
          &lt;/Root&gt;
      &lt;/Loggers&gt;
  &lt;/Configuration&gt;
  </code></pre>