context-name in WebApplicationInitializer

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

context-name in WebApplicationInitializer

Robert .
I'm trying to set the context-name for each web application to try to separate logging per web application as documented in

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?

slf4j-user mailing list
[hidden email]