On Jun 20, 2011, at 5:04 PM, Gary Gregory wrote: > > > On Jun 20, 2011, at 17:33, "ralph.goers @dslextreme.com" > <ralph.go...@dslextreme.com<mailto:ralph.go...@dslextreme.com>> wrote: > > > 2.) is there an optional support for ThreadContextClassLoader scenarios? > This is often a problem for logging in libraries which are on a shared > classpath. Imagine 2 webapps, both using OpenWebBeans as CDI container. One > webapp sets the org.apache.webbeans loglevel to debug, the other wone to WARN > ... > > As it currently stands, no, but I have always intended to introduce something > to support that. > > When I wrote the Log4j 2 API it took a stab at creating an abstraction to > bind the API to an implementation. It was only when I built the core that I > added the plugin support. Looking at how it is done it now occurs to me that > the plugin support really should move to the API and be used to bind to the > implementation. This would provide the flexibility needed to accomplish this. > > How much work us that?
This shouldn't be much work at all. I'll probably do it in the next few days. The only trick is the context selection criteria and making sure the LoggerContext and configuration are properly freed when the webapp shuts down. Logback uses JNDI lookups (see http://logback.qos.ch/manual/loggingSeparation.html#ContextJNDISelector) as well as a Servlet Context Listener. I'll probably do somethnig similar, although I'd prefer to do it with annotations. Ralph