<div dir="ltr"><div>I'm trying to set the context-name for each web application to try to separate logging per web application as documented in <a href="http://logback.qos.ch/manual/loggingSeparation.html" target="_blank">http://logback.qos.ch/manual/<wbr>loggingSeparation.html</a><br><br></div>I
 am using a WebApplicationInitializer so try to set the 
logback/context-name env-entry in Java code. I have tried the following 
in the onStartup method:<br><br><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"courier new";font-size:9pt">InitialContext initialContext = <span style="color:rgb(0,0,128);font-weight:bold">new </span>InitialContext();<br>initialContext.<wbr>addToEnvironment(<span style="color:rgb(0,128,0);font-weight:bold">"logback/<wbr>context-name"</span>, <span style="color:rgb(0,128,0);font-weight:bold">"mycontext"</span>);<br><br></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"courier new";font-size:9pt"><font face="arial,helvetica,sans-serif">I see logback is trying to get the contextName in ContextJNDISelector.<wbr>getLoggerContext().<br>Unfortunately the lookup returns null even though I can see the "logback/context-name" entry in ctx.getEnvironment()<br></font></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"courier new";font-size:9pt"><font face="arial,helvetica,sans-serif">What's the correct way to add the context-name to IntialContext?</font></pre></div>