title: Log4j2 configuration not able to write to a file
body: <p><code>Log4j2</code> configuration not able to write to a file with <code>Spring 5</code>. It shows the logs on the console but nothing gets written to the file. However the file is getting generated but it's empty.</p>
  
  <p><strong>pom.xml</strong></p>
  
  <pre><code>&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.3&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.3&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p><strong>src/main/resources/log4j2.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;Configuration status="warn"&gt;
          &lt;Properties&gt;
              &lt;Property name="basePath"&gt;/apps/istore/logs&lt;/Property&gt;
          &lt;/Properties&gt;
          &lt;Appenders&gt;
              &lt;RollingFile name="fileLogger" fileName="${basePath}/istore.log" filePattern="${basePath}/istore-%d{yyyy-MM-dd}.log"&gt;
                  &lt;PatternLayout&gt;
                      &lt;pattern&gt;[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n&lt;/pattern&gt;
                  &lt;/PatternLayout&gt;
                  &lt;Policies&gt;
                      &lt;TimeBasedTriggeringPolicy interval="1" modulate="true"/&gt;
                  &lt;/Policies&gt;
              &lt;/RollingFile&gt;
              &lt;Console name="console" target="SYSTEM_OUT"&gt;
                  &lt;PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"/&gt;
              &lt;/Console&gt;
          &lt;/Appenders&gt;
          &lt;Loggers&gt;
              &lt;Logger name="istore-logger" level="info" additivity="true"&gt;
                  &lt;appender-ref ref="fileLogger" level="info"/&gt;
              &lt;/Logger&gt;
              &lt;Root level="info" additivity="false"&gt;
                  &lt;appender-ref ref="console"/&gt;
              &lt;/Root&gt;
          &lt;/Loggers&gt;
      &lt;/Configuration&gt;
  </code></pre>
  
  <p><strong>MyFilter.java</strong></p>
  
  <pre><code>import org.apache.logging.log4j.LogManager;
  import org.apache.logging.log4j.Logger;
  
  public class MyFilter extends OncePerRequestFilter {
  
      private static final Logger logger = LogManager.getLogger(MyFilter.class);
  
      @Override
      protected void doFilterInternal(HttpServletRequest request,
                                      HttpServletResponse response,
                                      FilterChain filterChain) throws ServletException, IOException {
  
          logger.info("@@@@@@@@@@@@@@doFilterInternal");
          ...
          ...     
  }   
  </code></pre>
  
  <p><strong>Console Logs:</strong></p>
  
  <pre><code>[INFO ] 2020-06-09 12:30:49.381 [http-nio-8080-exec-2] MyFilter - @@@@@@@@@@@@@@doFilterInternal
  </code></pre>