[slf4j-user] Fail Silently on NOP implementation

Joachim Durchholz jo at durchholz.org
Fri Apr 29 13:55:49 UTC 2016


Am 29.04.2016 um 13:03 schrieb Phillip Lord:
> I think that things have got a little side-tracked by this discussion
> really. The problem at hand is whether a library should *by default*
> print to standard out/err even in the absence of an error condition.
>
> I think it should not.

It MUST.
Not having a logging backend is a configuration error.

> I do acknowledge the bootstrap difficulty this causes for SLF4J, but
> there are solutions. The issue of library vs. application only comes
> into question when we discuss the problem with your solution (i.e bind
> to nop).

Simply throwing everything away without even giving a warning is 
unacceptable, since that would be another potential reason why the log 
messages don't appear. Think large systems with complex configurations, 
multiple log destinations, built by many teams; logging is a 
cross-cutting concern, and the question "why don't the logs appear" is a 
common one that can happen for any number of configuration problems.

It's a good thing if you get a distinguishable error message in this 
particular failure scenario.
Of course, it's an annoyance for you, but adding the nop logger as a 
dependency shouldn't be hard since you already got slf4j-api.


More information about the slf4j-user mailing list