title: how to define logback variables/properties before logback auto-load logback.xml?
body: <p>My company has an environment management tool that enables you to look up properties from the environment programmatically in Java. I want to leverage this tool to configure logback. For example, suppose I have a logback.xml as follows (the file appender section in particular):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration&gt;
      &lt;!-- console appender --&gt;
      &lt;appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"&gt;
          &lt;encoder&gt;
              &lt;pattern&gt;%d{yyyy-MM-dd/HH:mm:ss.SSS} [%thread] %-5level %logger{20}: %msg%n&lt;/pattern&gt;
          &lt;/encoder&gt;
      &lt;/appender&gt;
  
      &lt;!-- file appender --&gt;
      &lt;appender name="FILE" class="ch.qos.logback.core.FileAppender"&gt;
          &lt;file&gt;${LOG_FILE:-/default/log/file/path&lt;/file&gt;
          &lt;encoder&gt;
              &lt;pattern&gt;%d{yyyy-MM-dd/HH:mm:ss.SSS} [%thread] %-5level %logger{20}: %msg%n&lt;/pattern&gt;
          &lt;/encoder&gt;
      &lt;/appender&gt;
  
      &lt;root level="DEBUG"&gt;
          &lt;appender-ref ref="CONSOLE" /&gt;
          &lt;appender-ref ref="FILE" /&gt;
      &lt;/root&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>So, in this case, I want to look up the <code>LOG_FILE</code> property from the environment (or OS, if you will), and pass it to logback before logback loads the logback.xml so that it will know the value of <code>LOG_FILE</code>. So, how can I achieve that? BTW, I know how to define a file appender programmatically, but that's not what I want here. </p>
  
  <p>Thank you very much.</p>