[slf4j-user] Fail Silently on NOP implementation
Joachim Durchholz
jo at durchholz.org
Thu Apr 28 21:02:10 UTC 2016
Am 28.04.2016 um 22:15 schrieb Phillip Lord:
>
> This is not true. My library has around 70 dependencies, some of which I
> have never heard of. As the recent debacle with left-pad and NPM has
> shown, very few people are consciously aware of all their dependencies.
I agree with your sentiment that one shouldn't need to bother that much
about indirect dependencies; I think logging has become because it's a
cross-cutting concern, just like the availability of stdout and whether
it's a tty or a pipe.
Now if you're writing a library you should never bother with logging
configuration. Maybe make sure it doesn't clutter your unit-testing
output, but that's more cosmetic than anything else.
If, on the other hand, you're writing an application, you definitely
need to configure logging.
The good news is that the NOP logger message you are seeing is just a
misconfiguration. I don't know who's responsible; you need to check
direct and indirect dependencies and see what libraries are pulling in a
backend, and exclude dependencies (many libraries are misguided in that
they declare a dependency on a logging backend, and you need to exclude
that).
Dependency sanitizing is something that you need to do, occasionally,
even if you shouldn't have to if everybody were doing things right.
> Yes, although these do not equate to the artifacts. slf4j-api is
> actually the API and the NOP logger.
Last time I looked these were different libraries. I dimly recall that
slf4j-api didn't even pull in any logger as a dependency; it certainly
shouldn't, though it's possible that it does just to be able to simply
output messages in case of misconfiguration - which is what I assume you
are seeing.
Anyway - did the SLF4J artifacts change their composition or their
dependencies?
> If not, I will just include slf4j-nop directly and leave it at that.
From the keywords I have seen, you're getting messages because you have
more than one logging backend in your classpath, slf4j-nop and something
else. Including slf4j-nop will not change anything about that.
I'm just guessing about details though; let us know how things worked
out for you.
More information about the slf4j-user
mailing list