title: How to configure Log4j2 by runtime-path (working directory) XML file, not classpath
body: <p>I cannot <a href="http://logging.apache.org/log4j/2.x/manual/configuration.html#XML" rel="nofollow">configure Log4j2</a> to <strong>read configuration from XML file in working directory</strong>.</p>
  
  <p>I was trying to set system property as documentation says:</p>
  
  <blockquote>
    <p>Log4j will inspect the "log4j.configurationFile" system property and,
    if set, will attempt to load the configuration using the
    ConfigurationFactory that matches the file extension</p>
  </blockquote>
  
  <p>with Main class static initializer block, also in <code>main</code> method, with relative and absolute paths:</p>
  
  <ul>
  <li><p><code>System.setProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
  "E:/log4j2.xml");</code></p></li>
  <li><p><code>System.setProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
  "./log4j2.xml");</code></p></li>
  <li><code>System.setProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
  "log4j2.xml");</code></li>
  </ul>
  
  <p>Also with <code>"log4j.configurationFile"</code> instead of <code>XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY</code> and nothing of that works.</p>
  
  <p>This configuration <strong>works only if I add XML to my classpath by putting it in <code>src</code> directory</strong>. I want to allow post-compilation lightweid configuration by editing XML file in working directory.</p>
  
  <p>Used dependencies:</p>
  
  <ul>
  <li><a href="http://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core/2.0-beta9" rel="nofollow"><code>log4j-core-2.0-beta9.jar</code></a></li>
  <li><a href="http://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api/2.0-beta9" rel="nofollow"><code>log4j-api-2.0-beta9.jar</code></a></li>
  <li><a href="http://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl/2.0-beta9" rel="nofollow"><code>log4j-slf4j-impl-2.0-beta9.jar</code></a></li>
  <li><a href="http://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.5" rel="nofollow"><code>slf4j-api-1.7.5.jar</code></a></li>
  </ul>