title: Log4j set a different logging level for each appender
body: <p>I'm using <a href="https://logging.apache.org/log4j/2.x/manual/index.html" rel="noreferrer">Log4j 2</a> to log the events of my application. However I'm stuck at the following problem.</p>
  
  <p>Currently all logging messages are being written to two different appenders. One has <a href="https://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender" rel="noreferrer">RollingFile</a> type, while the other has <a href="https://logging.apache.org/log4j/2.x/manual/appenders.html#ConsoleAppender" rel="noreferrer">Console</a> type. </p>
  
  <p>What I want is for the RollingFile appender to log messages with an INFO level or higher (ERROR, FATAL), and for the Console appender to log messages with an ERROR level or higher (FATAL).</p>
  
  <p>Inside my log4j2.xml file I seem to be only able to declare the logging level for an entire logger (including all of its appenders). Here is my log4j2.xml file:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Configuration monitorInterval="30"&gt;
      &lt;Appenders&gt;
          &lt;Console name="Console" target="SYSTEM_OUT"&gt;
              &lt;PatternLayout&gt;
                  &lt;Pattern&gt;%d %level %msg%n&lt;/Pattern&gt;
              &lt;/PatternLayout&gt;
          &lt;/Console&gt;
          
          &lt;RollingFile name="Log" fileName="log/Log.log" filePattern="log/Log-%d{yyyy-MM-dd}-%i.log" append="false"&gt;
              &lt;PatternLayout&gt;
                  &lt;Pattern&gt;%d %level %msg%n&lt;/Pattern&gt;
              &lt;/PatternLayout&gt;
              &lt;Policies&gt;
                  &lt;SizeBasedTriggeringPolicy size="1 MB" /&gt;
              &lt;/Policies&gt;
              &lt;DefaultRolloverStrategy max="10"/&gt;
          &lt;/RollingFile&gt;
      &lt;/Appenders&gt;
  
      &lt;Loggers&gt;
          &lt;Root level="info"&gt;
              &lt;AppenderRef ref="Console" /&gt;
              &lt;AppenderRef ref="Log" /&gt;
          &lt;/Root&gt;
      &lt;/Loggers&gt;
  &lt;/Configuration&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Is there an easy way of doing so? I searched log4j documentation but couldn't find what I was looking for (Maybe I missed it?). If it's possible I would really prefer for the solution to be applicable on any appenders' types; not specific for RollingFile and Console.</p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>I saw many questions where it was asked to write <strong>ONLY</strong> the messages from a certain level to a file, while writing the messages from a different level to a different file. In my case I need the messages with a certain level of <strong>HIGHER</strong> to be written to different files. For example in the case I provided messages with level ERROR or FATAL will be written to both the RollingFile and Console, while messages with level INFO will be written to RollingFile only.</p>