[logback-dev] Better introspection into logging setup
Durchholz, Joachim
Joachim.Durchholz at hennig-fahrzeugteile.de
Thu Feb 25 14:46:16 CET 2010
Taken here from Bugzilla #169 on Ceki's request.
Reworded to improve presentation.
Within the SLF4J framework, I'd like to
- have a way to enumerate all active loggers, and find out at what
logging levels they are, and
- get an event whenever the set of active loggers or their configuration
changes.
The use case is this:
I need to integrate multiple libraries, each using a different logging
framework.
Some of them use java.util.logging, and since j.u.l. does not respond
directly to the SLF4J configuration, I currently need to keep two sets
of configurations, one for SLF4J loggers and one for j.u.l. (I could
have the bridge run with maximum logging and let the SLF4J side sort out
which messages are needed and which aren't, but that's killing
performance.)
Design considerations (i.e. that's how far I got):
So I thought I'd hack something for the j.u.l. bridge to mimick the
SLF4J loggers. E.g. iterate over all SLF4J loggers and install a
corresponding j.u.l logger, instead of installing a root logger and
logging everything.
Turns out LoggerFactory does not return a list of active loggers :(
The other thought that occurred to me what as SLF4J-managed loggers are
reconfigured at runtime, they should inform the j.u.l. brigde so it can
reconfigure the j.u.l. side as well.
Feedback welcome.
Regards,
Jo
More information about the logback-dev
mailing list