[slf4j-dev] SL4FJ light: ad-hoc bindings for friendlier OSGi/IoC integration

Simon Chemouil schemouil+slf4j at gmail.com
Mon Oct 15 20:54:18 CEST 2012


Matthew Bishop <Matthew.Bishop <at> elasticpath.com> writes:
[snip]
> My experience with inject vs. static binding to loggers is mixed, meaning some 
people won't, or cannot,
> accept the injected approach. We need to have both methods of acquiring logger 
instances.
> 
> I have a Guice injection module that I can contribute. I think you have 
something similar for Spring.
> Interested in putting something together as an injection starting point?

Matthew,

I agree the first concern should be to keep a clear backwards-compatibility 
route and that applies to clients using LoggerFactory.getLogger() static calls, 
as well as to implementation providers expecting a hook on StaticLoggerBinding. 
Clearly, it means we must keep the whole system.

However, it seems reasonably easy and with little side effects to just "cut" the 
system into its own JAR.

It is then up to users to choose whether they want to keep using static binding 
and drop that support JAR in their classpath, or whether they want to do the 
wiring using their favorite injection framework (using ILoggerFactory.class as 
service/injection key).

I think that once we have made that cut, we could provide handy bindings for 
integration with DI frameworks such as the Guice bindings you made. I found the 
Spring example through a Google search, but I am personally writing such an 
extension for iPojo, an OSGi component framework. 

-- 
Simon


> 




More information about the slf4j-dev mailing list