title: Log4j 2 root logger overrides everything?
body: <p>I am relatively new to Log4j 2. Currently, I have this configuration file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Configuration status="WARN"&gt;
    &lt;Appenders&gt;
      &lt;File name="DebugFile" fileName="../../logs/debug.log"&gt;
        &lt;PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/&gt;
      &lt;/File&gt;
      &lt;File name="BenchmarkFile" fileName="../../logs/benchmark.log"&gt;
        &lt;PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/&gt;
      &lt;/File&gt;
    &lt;/Appenders&gt;
    &lt;Loggers&gt; 
      &lt;Logger name="com.messaging.main.ConsoleMain" level="debug"&gt;
        &lt;AppenderRef ref="DebugFile"/&gt;
      &lt;/Logger&gt;
      &lt;Logger name="com.messaging.main.ClientMain" level="debug"&gt;
        &lt;AppenderRef ref="BenchmarkFile"/&gt;
      &lt;/Logger&gt;   
      &lt;Root level="error"&gt;
        &lt;AppenderRef ref="DebugFile"/&gt;
      &lt;/Root&gt;
    &lt;/Loggers&gt;
  &lt;/Configuration&gt;
  </code></pre>
  
  <p>If I log something in these two classes ConsoleMain and ClientMain via a static Logger</p>
  
  <pre><code>    static Logger _logger = LogManager.getLogger(ClientMain.class.getName());
  </code></pre>
  
  <p>and</p>
  
  <pre><code>    static Logger _logger = LogManager.getLogger(ConsoleMain.class.getName());
  </code></pre>
  
  <p>they ALWAYS use the appender and level of the root logger. If the level of the root logger is "error" as above, it never shows any debug level logging output, even if the level of the individual loggers is debug. Also, it always appends to the log file specified in the root logger and not the one specified in the logger of the classes.</p>
  
  <p>So, it seems that the root logger somehow overrides everything. How do I get log4j to actually use the appender and the level of the loggers of the classes?</p>
  
  <p>I tried removing the appender of the root, but then it does not log anything.</p>
  
  <p>Thank you!</p>