1

I have an internal library that was upgrade to use logstash which has a mandatory dependency to logback, hence logback-classic (which has its own slf4j appender internally of its packages, which means I can't exclude any library here).

When I try to use this dependency as a jar over any other legacy module (all of them are using slf4j-log4j12) I do get the log dependency hell message:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/asdf/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/asdf/.m2/repository/org/slf4j/slf4j-log4j12/1.7.26/slf4j-log4j12-1.7.26.jar!/org/slf4j/impl/StaticLoggerBinder.class]

but the problem itself is that I can't just exclude logback-classic, since it is mandatory for logstash, and I can't migrate my applications to use logback, since they are configured with the log4j.xml

Is there a way to force slf4j to use the application appender instead of the one that comes from the logback library, OR, any other idea to make just a given package to use an appender, and the rest, use other?

irobson
  • 825
  • 8
  • 20

0 Answers0