-
How can I get rid of the internal SLF4J messages (info, warnings, errors)? The case is that I already limited dependencies to the bare minimum and configured the SLF4J implementation (Log4j2), but I'm still getting some of the SLF4J messages printed directly to the console. I have a utility app which should print only the JSON output to the console, which is then processed by Jenkins. But the SLF4J adds its own message:
or
and fails the build due to assertion checks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You should clean up your dependency stack from all SLF4J implementations, except the one you are using. If you use Maven, you can do it with Unfortunately there is no Maven Enforcer rule counts the number of service implementations on your stack, so you need to ban them explicitly. If you use
Note: If you didn't add any of these dependencies explicitly to your runtime, you should check which dependency leaks them and report the issue to the appropriate project. A lot of libraries leak SLF4J implementations as required runtime dependencies. |
Beta Was this translation helpful? Give feedback.
You should clean up your dependency stack from all SLF4J implementations, except the one you are using. If you use Maven, you can do it with
an enforcer rule like this one and fix all the errors using exclusions.
Unfortunately there is no Maven Enforcer rule counts the number of service implementations on your stack, so you need to ban them explicitly. If you use
o.a.l.l:log4j-slf4j2-impl
, you should ban:c.q:logback-classic
,o.a.l.l:log4j-slf4j-impl
,o.s:slf4j-nop
,o.s:slf4j-simple
,o.s:slf4j-jdk14
,o.s:slf4j-reload4j
.Note: If you didn't add any of these dependencies explicitly to your runtime, you should check which dependency leaks them and report the issue to the appropriate projec…