title: How do i use different logging levels for different classes with log4j2?
body: <p>In the log4j2 documentation <a href="http://logging.apache.org/log4j/2.x/manual/configuration.html" rel="noreferrer">log4j2 java configuration</a> the default configuration is this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Configuration status="WARN"&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;/Appenders&gt;
    &lt;Loggers&gt;
      &lt;Root level="error"&gt;
        &lt;AppenderRef ref="Console"/&gt;
      &lt;/Root&gt;
    &lt;/Loggers&gt;
  &lt;/Configuration&gt;
  </code></pre>
  
  <p>This will produce logging for levels ERROR or FATAL to the Console. My default logging works in the same way. The problem i run into is when I do this, though:</p>
  
  <pre><code>&lt;logger name="com.foo.Bar" level="TRACE"/&gt;
  &lt;Root level="ERROR"&gt;
    &lt;AppenderRef ref="STDOUT"&gt;
  &lt;/Root&gt;
  </code></pre>
  
  <p>According to the documentation, <a href="http://logging.apache.org/log4j/2.x/manual/configuration.html" rel="noreferrer">log4j2 java configuration</a>, this will </p>
  
  <blockquote>
    <p>eliminate all the TRACE output from everything except com.foo.Bar.</p>
  </blockquote>
  
  <p>My implementation, on the other hand, works as though the </p>
  
  <pre><code>&lt;logger name="com.foo.Bar" level="TRACE"/&gt;
  </code></pre>
  
  <p>wasn't even there. It will still only print out error logs.</p>
  
  <p><strong>Questions</strong></p>
  
  <ul>
  <li>Has anyone else encountered this problem?</li>
  <li>Can anyone reproduce it?</li>
  <li>Does anyone know how to fix it? I almost would give someone a dollar. I would definitely settle for marking their answer green, though.</li>
  </ul>
  
  <p>Here is some information about my setup:</p>
  
  <p><strong>Maven Dependencies</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.0-beta9&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.0-beta9&lt;/version&gt;
        &lt;/dependency&gt;
      &lt;dependency&gt;
  </code></pre>
  
  <p><strong>Other</strong></p>
  
  <p>I am testing this in the appropriate class. I am running a JUnit test file. I've used a src/main .xml file and i've used a src/test .xml file. Both end up with the same results.</p>
  
  <p><strong>End Goal</strong></p>
  
  <p>My end goal is to have a specific logger send SMTP requests. I am pretty sure I know how to do this, i am just struggling with this small problem</p>