
31 Oct
2016
31 Oct
'16
10:24 a.m.
I'm trying to set the context-name for each web application to try to separate logging per web application as documented in http://logback.qos.ch/manual/loggingSeparation.html 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: InitialContext initialContext = new InitialContext(); initialContext.addToEnvironment("logback/context-name", "mycontext"); I see logback is trying to get the contextName in ContextJNDISelector.getLoggerContext(). Unfortunately the lookup returns null even though I can see the "logback/context-name" entry in ctx.getEnvironment() What's the correct way to add the context-name to IntialContext?