title: Log4j2 Async Logger Not Logging Anything
body: <p>I am trying to implement an Async Logger along with a Spring Boot Application. My <code>log4j2.xml</code> (I have it under <code>/src/resources/</code> directory) looks like:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;Configuration status=&quot;ALL&quot;&gt;
      &lt;Appenders&gt;
          &lt;Console name=&quot;CONSOLE&quot; target=&quot;SYSTEM_OUT&quot;&gt;
              &lt;PatternLayout pattern=&quot;%d %-5p [%t] %C{2} (%F:%L) - %m%n&quot; /&gt;
          &lt;/Console&gt;
          &lt;!-- Generate rolling log for router with per hour interval policy --&gt;
          &lt;RollingFile name=&quot;ProcessorRollingFile&quot; fileName=&quot;C:/logs/&quot;&gt;
              &lt;PatternLayout&gt;
                  &lt;pattern&gt;%d{ISO8601} [%t] %p %c %L - %m%n&lt;/pattern&gt;
              &lt;/PatternLayout&gt;
              &lt;Policies&gt;
                  &lt;TimeBasedTriggeringPolicy interval=&quot;1&quot; modulate=&quot;true&quot;/&gt;
              &lt;/Policies&gt;
              &lt;DefaultRolloverStrategy max=&quot;24&quot; /&gt;
          &lt;/RollingFile&gt;
          &lt;!-- Register Async appender --&gt;
          &lt;Async name=&quot;AsyncRollingFile&quot;&gt;
              &lt;AppenderRef ref=&quot;ProcessorRollingFile&quot; /&gt;
          &lt;/Async&gt;
      &lt;/Appenders&gt;
      &lt;Loggers&gt;
          &lt;AsyncLogger name=&quot;com.gtt.gcas&quot; level=&quot;all&quot; additivity=&quot;false&quot; includeLocation=&quot;true&quot;&gt;
              &lt;AppenderRef ref=&quot;AsyncRollingFile&quot; /&gt;
          &lt;/AsyncLogger&gt;
      &lt;/Loggers&gt;
  &lt;/Configuration&gt;
  </code></pre>
  <p>I have written a generic class, that can be called from other classes to log stuff. I wish to expand on it later, right now its very basic.</p>
  <pre><code>package com.gtt.gcas.logging;
  
  import org.apache.logging.log4j.Level;
  import org.apache.logging.log4j.LogManager;
  import org.apache.logging.log4j.Logger;
  
  public class GCasLogging {
      
      private static Level LOG_LEVEL = Level.ALL;
      
      public static Logger logger = LogManager.getLogger(GCasLogging.class);
      
  
      /**
       * @return the lOG_LEVEL
       */
      public static Level getLogLevel() {
          return LOG_LEVEL;
      }
      
  
      /**
       * @param lOG_LEVEL the lOG_LEVEL to set
       */
      public static void setLogLevel(Level logLevel) {
          LOG_LEVEL = logLevel;
      }
  }
  </code></pre>
  <p>And I am using the above class like so:</p>
  <pre><code>package com.gtt.gcas.preload;
  
  import org.apache.logging.log4j.LogManager;
  import org.apache.logging.log4j.Logger;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.boot.CommandLineRunner;
  import org.springframework.context.annotation.Bean;
  import org.springframework.stereotype.Component;
  
  import com.gtt.gcas.employee.repository.EmployeeRepository;
  import com.gtt.gcas.logging.NCaasLogging;
  import com.gtt.trial.employee.pojo.Employee;
  
  @Component
  class LoadDatabase implements CommandLineRunner {
  
      EmployeeRepository employeeRepository;
  
      @Autowired
      public LoadDatabase(EmployeeRepository employeeRepository) {
          this.employeeRepository = employeeRepository;
      }
  
  
  
      @Bean
      void initDatabase() {
          
          Logger logger = NCaasLogging.logger;
          
          Employee employee = new Employee(&quot;Bilbo Baggins&quot;, &quot;burglar&quot;);
          
          logger.info(&quot;One Employee Added.&quot;);
          
          employeeRepository.save(employee);
          
          employee = new Employee(&quot;Frodo Baggins&quot;, &quot;thief&quot;);
          
          logger.info(&quot;Second Employee Added.&quot;);
      }
  
      @Override
      public void run(String... args) throws Exception {
          // TODO Auto-generated method stub
  
      }
  }
  </code></pre>
  <p>My dependencies section in the <code>pom.xml</code> is like:</p>
  <pre><code>&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;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.session&lt;/groupId&gt;
          &lt;artifactId&gt;spring-session-core&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;optional&gt;true&lt;/optional&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-log4j2 --&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;!-- https://mvnrepository.com/artifact/com.lmax/disruptor --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.lmax&lt;/groupId&gt;
          &lt;artifactId&gt;disruptor&lt;/artifactId&gt;
          &lt;version&gt;4.0.0.RC1&lt;/version&gt;
      &lt;/dependency&gt;
      
      &lt;!-- https://mvnrepository.com/artifact/javax.persistence/persistence-api --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.persistence&lt;/groupId&gt;
          &lt;artifactId&gt;persistence-api&lt;/artifactId&gt;
          &lt;version&gt;1.0.2&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-jpa --&gt;
      &lt;!-- This has vulnerability CVE-2022-21724 --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
          &lt;artifactId&gt;spring-data-jpa&lt;/artifactId&gt;
      &lt;/dependency&gt;
      
      &lt;!-- https://mvnrepository.com/artifact/com.h2database/h2 --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.h2database&lt;/groupId&gt;
          &lt;artifactId&gt;h2&lt;/artifactId&gt;
      &lt;/dependency&gt;
      
  &lt;/dependencies&gt;
  </code></pre>
  <p>But the problem is, it does not create any logs. The folder C:\logs does not even get created, let alone the files under it.</p>
  <p>Please help.</p>