Important
You are viewing documentation for an older version of Confluent Platform. For the latest, click here.
Configure Docker Logging¶
log4j log levels¶
To change the default logging levels or add new logging levels:
- Change the
{COMPONENT}_LOG4J_ROOT_LOGLEVEL
to changerootLogger
loglevel. - Add or override default loggers by using
{COMPONENT}_LOG4J_LOGGERS
environment variable. This variable accepts the comma separated values of the logger config. For example, to override the log levels of controller and request loggers , useKAFKA_LOG4J_LOGGERS="kafka.controller=WARN,kafka.foo.bar=DEBUG"
. - To change the logging levels for the tools, use the
{COMPONENT}_LOG4J_TOOLS_ROOT_LOGLEVEL
.
Replace {COMPONENT}
as below for the component 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 |
An example command to change the log level for Kafka is:
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:5.5.15
Change log outputs¶
All logs are sent to stdout
by default. You can change this by
extending the images.