Spring Boot: Using Tomcat context parameters in logback configuration
<p>I have several instances of a Spring Boot app deployed in a unique Tomcat.
Each app is configured with a context.xml file which contains a customer code </p>

<pre><code>&lt;Context path="/myApp1" reloadable="false"&gt;
    &lt;Parameter name="CUSTOMER_CODE" value="CUSTOMER1" /&gt;
&lt;/Context&gt;
</code></pre>

<p>I wish that each customer has a separate log based on code defined in context.xml.</p>

<p>Unfortunately this config doesn't work in my logback-config.xml:</p>

<pre><code>&lt;property name="LOG_FILE" value="${ROOT_LOG}/${CUSTOMER_CODE}/myApp.log}"/&gt;
</code></pre>

<p>A folder CUSTOMER_CODE_IS_UNDEFINED is created in "ROOT_LOG" directory. "ROOT_LOG" is provided by a system property.</p>

<p>Is there any way to make this logback configuration working?</p>

<p>The use of properties defined in application.properties works well (I renamed my logback.xml to logback-spring.xml). It seems to me that Spring boot does not set Tomcat context parameters in Environnement before initialize logging. Any idea for a workaround? Thanks.</p>