title: log4j2 - StatusLogger No Log4j 2 configuration file found. Using default configuration
body: <p>This is my configuration file:</p>
  
  <pre><code>&lt;Configuration status="INFO"&gt;
    &lt;Properties&gt;
      &lt;Property name="log-path"&gt;./log&lt;/Property&gt;
    &lt;/Properties&gt;
    &lt;Appenders&gt;
      &lt;RollingFile name="RollingFile" fileName="${log-path}/mylog.log" filePattern="${log-path}/mylog-%d{yyyy-MM-dd}-%i.log"&gt;
        &lt;PatternLayout&gt;
          &lt;pattern&gt;%d{yyyy-MM-dd HH:mm:ss.SSS} [%p]\t%m%n&lt;/pattern&gt;
        &lt;/PatternLayout&gt;
        &lt;Policies&gt;
          &lt;SizeBasedTriggeringPolicy size="10 MB" /&gt;
        &lt;/Policies&gt;
        &lt;DefaultRolloverStrategy max="32" /&gt;
      &lt;/RollingFile&gt;
  
  
      &lt;Console name="STDOUT" target="SYSTEM_OUT" ignoreExceptions="false"&gt;
        &lt;PatternLayout&gt;
          &lt;pattern&gt;%n%d{yyyy-MM-dd HH:mm:ss.SSS} [%p]\t%m&lt;/pattern&gt;
        &lt;/PatternLayout&gt;
      &lt;/Console&gt;
    &lt;/Appenders&gt;
    &lt;Loggers&gt;
      &lt;Logger name="mylog" level="debug" additivity="false"&gt;
        &lt;appender-ref ref="RollingFile" level="DEBUG" /&gt;
        &lt;appender-ref ref="STDOUT" level="DEBUG" /&gt;
      &lt;/Logger&gt;
  
    &lt;/Loggers&gt;
  &lt;/Configuration&gt;
  </code></pre>
  
  <p>But I get the following error:</p>
  
  <p>ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See <a href="https://logging.apache.org/log4j/2.x/manual/configuration.html" rel="nofollow noreferrer">https://logging.apache.org/log4j/2.x/manual/configuration.html</a> for instructions on how to configure Log4j 2</p>
  
  <p>How can I solve it?</p>
  
  <p>This is my Maven dependency:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
      &lt;artifactId&gt;log4j-api&lt;/artifactId&gt;
      &lt;version&gt;2.11.0&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>The log configuration file is very clearly read, since it correctly writes using the defined patterns in my /log directory. </p>
  
  <p>This is how I instantiate it in my code:</p>
  
  <pre><code>LoggerContext lcontext = (org.apache.logging.log4j.core.LoggerContext)  LogManager.getContext(false)
  Logger logger = LogManager.getLogger("mylog");
  </code></pre>