[slf4j-dev] [Bug 206] Allow configuring SLF4J's log level at runtime

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Thu Dec 2 11:33:26 CET 2010


http://bugzilla.slf4j.org/show_bug.cgi?id=206





--- Comment #7 from Robert Elliot <robert at teviotia.co.uk>  2010-12-02 11:33:26 ---
Since you're inclined to argue, I would say that even if you are correct and
there "all _feasible_ implementations of SLF4J should ... filter messages by
their level", adding this capability to the SLF4J API incorrectly mixes the two
concerns of logging a message and choosing what to do with that message.  As it
stands the SLF4J API only deals with the concern of logging a message, and
leaves what to do with it entirely to the implementation.

This means that if a library you depend on depends only on slf4j-api you can be
confident that it does not do anything to alter the logging configuration of
your application*, which is as it should be - a library has no business
deciding for the end application what log statements it is or is not interested
in.  And it also means that as a library developer you can be confident that
you are not doing anything bad like that so long as you just depend on slf4j. 
A nice clear separation of concerns.  The end application is the appropriate
place to decide what logging message should go where, and of course the end
application knows what slf4j implementation is being used and can configure it
directly.

I disagree with your original thesis, though - I don't think SLF4J should be
makign as all encompassing a claim as that "all _feasible_ implementations of
SLF4J should ... filter messages by their level".  It may make perfect sense
for some to keep all logged data for some reason, or to filter it on some basis
other than level.  In general an interface should be very wary of daring to
predict what might constitute the set of all feasible implementations.  There
is already an slf4j implementation that does no filtering, and uses the level
solely to print it at the front of the message - slf4j-simple.


* assuming it doesn't do anything really malicious with reflection


-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the slf4j-dev mailing list