'confluentinc/cp-kafka docker log4j warnings

docker pull confluentinc/cp-kafka 

I use this code to pull the kafka image. Then, use the following to start the containers.

docker run --rm -d --name kafka-server -p 9092:9092 -e ALLOW_PLAINTEXT_LISTENER=yes -e KAFKA_ZOOKEEPER_CONNECT=192.168.1.164:2181 -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 confluentinc/cp-kafka

However, it will immediately shut down and given the logs:

log4j:WARN No appenders could be found for logger (io.confluent.admin.utils.cli.ZookeeperReadyCommand).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

How to solve this log4j error? (By terminal)



Solution 1:[1]

You fix it by providing KAFKA_LOG4J_LOGGERS variable. For example

-e KAFKA_LOG4J_LOGGERS="kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"

Note: ALLOW_PLAINTEXT_LISTENER=yes is for bitnami/kafka image, not Confluent ones

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 OneCricketeer