Configure Docker Logging

Log4j log levels

You can change the default log4j logging levels or add new logging levels for a Confluent Platform component. For details on log4j settings, see Log4j Configuration.

Use the following table to replace {COMPONENT} in this section with the component name you are changing the log level for.

Component {COMPONENT}
ZooKeeper ZOOKEEPER
Kafka KAFKA
Confluent Control Center CONTROL_CENTER
Schema Registry SCHEMA_REGISTRY
REST Proxy KAFKA_REST
Kafka Connect CONNECT
ksqlDB KSQL
Replicator REPLICATOR
To change the log level of rootLogger:
Use the {COMPONENT}_LOG4J_ROOT_LOGLEVEL environment variable.
To add or override default loggers:

Use the {COMPONENT}_LOG4J_LOGGERS environment variable. This variable accepts the comma separated values of the logger config.

For example, to override the log levels for Kafka controller and request loggers, set:

KAFKA_LOG4J_LOGGERS="kafka.controller=TRACE,kafka.request.logger=WARN"
To change the logging levels for the tools:
Use the {COMPONENT}_LOG4J_TOOLS_ROOT_LOGLEVEL environment variable.

An example command to change the log levels for Kafka:

docker run -d \
  --name=kafka-log-example \
  --net=host \
  -e KAFKA_BROKER_ID=1 \
  -e KAFKA_ZOOKEEPER_CONNECT=localhost:32181/jmx \
  -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:39092 \
  -e KAFKA_JMX_PORT=39999 \
  -e KAFKA_LOG4J_LOGGERS="kafka.controller=WARN,kafka.foo.bar=DEBUG" \
  -e KAFKA_LOG4J_ROOT_LOGLEVEL=WARN \
  -e KAFKA_TOOLS_LOG4J_LOGLEVEL=ERROR \
  -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 \
  confluentinc/cp-kafka:7.2.8

Log4j log outputs

All log4j logs are sent to stdout by default. You can change this by extending the images.