cp-kafka-connect fails inconsistently due to multiple loggers in classpath
See original GitHub issueHi!
This refers to cp-kafka-connect:7.0.1
.
When running cp-kafka-connect docker image we stumble upon inconsistent behavior of SLF4J. The default CUB_CLASSPATH
is set to /usr/share/java/cp-base-new/
where multiple loggers exists:
slf4j-simple-1.7.30.jar
slf4j-log4j12-1.7.30.jar
On one machine we consistently get the error:
===> Check if Kafka is healthy ...
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/share/java/cp-base-new/slf4j-log4j12-1.7.30.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/share/java/cp-base-new/slf4j-simple-1.7.30.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
log4j:WARN No appenders could be found for logger (io.confluent.admin.utils.cli.KafkaReadyCommand).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
So it finds multiple loggers (which are included in the image cp-kafka-connect), chooses Log4jLoggerFactory and proceeds to crash. The documentation provided (http://www.slf4j.org/codes.html#multiple_bindings) states that there should only be one logger defined in the class path.
However, on another machine we consistently get the output:
===> Check if Kafka is healthy ...
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/share/java/cp-base-new/slf4j-simple-1.7.30.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/share/java/cp-base-new/slf4j-log4j12-1.7.30.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
In this case it happens to choose SimpleLoggerFactory instead of Log4jLoggerFactory, and proceeds happily.
Workaround
Delete /usr/share/java/cp-base-new/slf4j-log4j12-1.7.30.jar
It seems like /usr/share/java/cp-base-new/slf4j-log4j12-1.7.30.jar
should not exist in the classpath
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:7
Top GitHub Comments
@stondini If you want to use 7.0.1 you can add this to your docker file to remove one of the loggers.
@oscarjohansson94 I get the same logs as you. I downgraded Connect to
confluentinc/cp-kafka-connect:6.1.4
which works well.