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

Gunnar Wagenknecht gunnar at wagenknecht.org
Wed Oct 17 09:53:16 CEST 2012


Hi Simon,

Thanks for initiating the discussion.

After reading through the proposal I was wondering if adding a setter to
LoggerFactory (note: over-simplified!) has been considered an option?

In combination with an activator for the SLF4J API this might be a
flexible and simple way to open the gate for a broad range of other
options without causing too much disruption in the user base.

Moving Logger and LoggerFactory out of "org.slf4j" just for the sake of
OSGi (or any other runtime environment) does not sound like the best
option to me. It causes migration grief for many, many users to satisfy
a (IMHO) much smaller group of SLF4J implementors/integrators.

FWIW, I captured my ideas in a simple commit:
https://github.com/guw/slf4j/commit/3cb841c5f3619992c7c4016fb36ffc5d2e9b7fbd

It's not meant to be functional complete an bullet prove but it should
outline the idea.

I think Ceki can provide more details of the effects this might cause.
For example, the method (in it's current implementation) allows changing
the factory at runtime multiple times. For this to work reliable, the
Loggers really need to become proxies to the actual ("current") logger.
They are usually held in static variables. A really dynamic OSGi
implementation might actually implement it that way. However, SLF4J can
simply delegate that complexity to the runtime.

-Gunnar

-- 
Gunnar Wagenknecht
gunnar at wagenknecht.org
http://wagenknecht.org/


More information about the slf4j-dev mailing list