title: How to log specific class with different levels to different appenders with LOG4J
body: <p>I have a situation where I have 2 appenders, one writing to console, another to file. I'd like to log everything with DEBUG level except for one class.
  For this class I want to log DEBUG to console and ERROR to file.</p>
  
  <p>I figured out that this kind of filtering is done by category tag, however I haven't managed to split different levels to different appenders on a specific class.</p>
  
  <p>is there a way to do it? </p>
  
  <p>Current configuration is the following :</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
  &lt;!DOCTYPE log4j:configuration SYSTEM "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd"&gt;
  &lt;log4j:configuration&gt;
      &lt;appender name="console" class="org.apache.log4j.ConsoleAppender"&gt;
          &lt;param name="encoding" value="UTF-8" /&gt;
          &lt;layout class="org.apache.log4j.PatternLayout"&gt;
              &lt;param name="ConversionPattern" value="%d{ISO8601}: %p [%t] %c - %m%n"/&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
  
      &lt;appender name="file-bl" class="org.apache.log4j.rolling.RollingFileAppender"&gt;
          &lt;param name="append" value="true"/&gt;
          &lt;rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy"&gt;
              &lt;param name="FileNamePattern" value="log/server-bl2.log.%d{yyyy-MM-dd}.gz"/&gt;
              &lt;param name="ActiveFileName" value="log/server-bl2.log"/&gt;
          &lt;/rollingPolicy&gt;
          &lt;layout class="org.apache.log4j.PatternLayout"&gt;
              &lt;param name="ConversionPattern" value="%d{ISO8601}: %p [%t] %c - %m%n"/&gt;
          &lt;/layout&gt;
      &lt;/appender&gt;
  
      &lt;logger name="org"&gt;
          &lt;level value="DEBUG"/&gt;
          &lt;appender-ref ref="console"/&gt;
          &lt;appender-ref ref="file-bl"/&gt;
      &lt;/logger&gt;
  
      &lt;logger name="org.springframework" additivity="false"&gt;
          &lt;level value="ERROR"/&gt;
          &lt;appender-ref ref="file-bl"/&gt;
      &lt;/logger&gt;
  
      &lt;root&gt;
          &lt;priority value="DEBUG" /&gt;
          &lt;appender-ref ref="console" /&gt;
          &lt;appender-ref ref="file-bl" /&gt;
      &lt;/root&gt;
  
  &lt;/log4j:configuration&gt;
  </code></pre>