title: Get Log4j2 log file location
body: <p>How can I get the location of a log4j log file?
  Log4j ver 2.3 Config:</p>
  
  <pre><code>&lt;Appenders&gt;
      &lt;RollingFile name="ROLLLOGAPPENDER" fileName="./log/${infoFile}.log" filePattern="./log/${infoFile}-%i.log" append="true"&gt;
          &lt;PatternLayout pattern="%d %-5p [%c{1}] %m%n"/&gt;
          &lt;ThresholdFilter level="${stdLevel}" onMatch="ACCEPT" onMismatch="DENY"/&gt;
          &lt;Policies&gt;
              &lt;SizeBasedTriggeringPolicy size="${sizeOfFile}" /&gt;
          &lt;/Policies&gt;
          &lt;DefaultRolloverStrategy max="${filesCount}"/&gt;
      &lt;/RollingFile&gt;
      &lt;Async name="ASYNC-LOG"&gt;
          &lt;AppenderRef ref="ROLLLOGAPPENDER"/&gt;
      &lt;/Async&gt;
  &lt;/Appenders&gt;
  </code></pre>
  
  <p>But it doesn't work:</p>
  
  <pre><code>import org.apache.logging.log4j.LogManager;
  import org.apache.logging.log4j.Logger;
  import org.apache.logging.log4j.core.LoggerContext;
  import org.apache.logging.log4j.core.appender.RollingFileAppender;
  import org.apache.logging.log4j.core.config.Configuration;
  ...
  
  LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
  Configuration config = ctx.getConfiguration();
  RollingFileAppender techical = (RollingFileAppender) config.getAppender(FILE_APPENDER_NAME);
  </code></pre>
  
  <p>java.lang.ClassCastException:</p>
  
  <pre><code>org.apache.logging.log4j.core.appender.AsyncAppender cannot be cast to org.apache.logging.log4j.core.appender.RollingFileAppender
  </code></pre>