How to define Log4j2 appender logging specific named logger only?
<p><code>
private static final Logger log = LogManager.getLogger(ABC.class);
private static final Logger resultLog = LogManager.getLogger("ResultLog");
</code></p>

<p>How can we define a appender that would only logs specific to "ResultLog" logger? </p>

<p>My current Log4j2.xml file looks like this:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;Configuration status="warn" name="ABC" packages=""&gt;
    &lt;Appenders&gt;
        &lt;RollingFile name="RollingFile" fileName="logs/ABC.log"
                     filePattern="logs/$${date:yyyy-MM}/ABC-%d{MM-dd-yyyy}-%i.log.gz"&gt;
            &lt;PatternLayout&gt;
                &lt;Pattern&gt;%d [%t] %p %c{1.} %m%n&lt;/Pattern&gt;
            &lt;/PatternLayout&gt;
            &lt;Policies&gt;
                &lt;TimeBasedTriggeringPolicy/&gt;
                &lt;SizeBasedTriggeringPolicy size="250 MB"/&gt;
            &lt;/Policies&gt;
        &lt;/RollingFile&gt;
        &lt;File name="resultFile" fileName="logs/result.log"&gt;
            &lt;PatternLayout pattern="%m%n"/&gt;
        &lt;/File&gt;
        &lt;Console name="Console" target="SYSTEM_OUT"&gt;
            &lt;PatternLayout pattern="%d [%t] %p %c{1.} %m%n"/&gt;
        &lt;/Console&gt;
    &lt;/Appenders&gt;

    &lt;Loggers&gt;
        &lt;Root level="debug"&gt;
            &lt;AppenderRef ref="RollingFile"/&gt;
            &lt;AppenderRef ref="Console"/&gt;
            &lt;AppenderRef ref="resultFile"/&gt;
        &lt;/Root&gt;
    &lt;/Loggers&gt;
&lt;/Configuration&gt;
</code></pre>

<p>thanks</p>