Confluent Control Center Logs¶
Use this topic to enable and manage logs for Control Center.
Control Center logging¶
Control Center and other Confluent Platform components use the Java-based logging utility
Apache Log4j to collect runtime data
and record component events. The following table describes each log level. The
Control Center Log4j properties file is located in the Confluent Platform installation
directory path etc/confluent-control-center/log4j.properties
.
Level | Description |
---|---|
OFF | Turns off logging. |
FATAL | Severe errors that cause premature termination. |
ERROR | Other runtime errors or unexpected conditions. |
WARN | Runtime situations that are undesirable or unexpected, but not necessarily wrong. |
INFO | Runtime events of interest at startup and shutdown. |
DEBUG | Detailed diagnostic information about events. |
TRACE | Detailed diagnostic information about everything. |
By default, Control Center writes INFO
, WARN
, ERROR
, and FATAL
information to standard output (stdout). If you want to see all events,
you can set DEBUG
or TRACE
logging levels.
Confluent also provides etc/confluent-control-center/log4j-rolling.properties
as an example of setting up Control Center with rolling log
files that are easier to manage. You can select your desired log4j configuration by
setting the CONTROL_CENTER_LOG4J_OPTS
environment variable
when starting Control Center.
Log4j property files¶
A default Control Center Log4j template file is provided with Confluent Platform. This properties
file is located in the Confluent Platform directory etc/confluent-control-center/log4j.properties
.
The following shows an example of what the default log file contains:
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n
Confluent also provides etc/confluent-control-center/log4j-rolling.properties
as an example of setting up Control Center with rolling log
files that simplify log management. The rolling log file creates three, size-limited log files
that isolate information:
control-center.log
- Control Center, HTTP activity, anything not related to streams, REST API callscontrol-center-streams.log
- Streamscontrol-center-kafka.log
- Client, ZooKeeper, and Kafka
The following shows an example of what the rolling log file contains:
# this is a sample log4j config that will roll log files
# lines with `File=` may need to be updated for your environment
log4j.rootLogger=INFO, main
# c3
log4j.appender.main=org.apache.log4j.RollingFileAppender
log4j.appender.main.File=${confluent.controlcenter.log.dir}/control-center.log
log4j.appender.main.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.main.layout.ConversionPattern=[%d] %p [%t] %m (%c)%n
log4j.appender.main.MaxFileSize=10MB
log4j.appender.main.MaxBackupIndex=5
log4j.appender.main.append=true
# streams
log4j.appender.streams=org.apache.log4j.RollingFileAppender
log4j.appender.streams.File=${confluent.controlcenter.log.dir}/control-center-streams.log
log4j.appender.streams.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.streams.layout.ConversionPattern=[%d] %p [%t] %m (%c)%n
log4j.appender.streams.filter.1=io.confluent.Log4jRateFilter
# will allow everything that is >=level
log4j.appender.streams.filter.1.level=WARN
# will only allow rate/second logs at <level
log4j.appender.streams.filter.1.rate=25
log4j.logger.org.apache.kafka.streams=INFO, streams
log4j.additivity.org.apache.kafka.streams=false
log4j.logger.io.confluent.controlcenter.streams=INFO, streams
log4j.additivity.io.confluent.controlcenter.streams=false
# kafka
log4j.appender.kafka=org.apache.log4j.RollingFileAppender
log4j.appender.kafka.File=${confluent.controlcenter.log.dir}/control-center-kafka.log
log4j.appender.kafka.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.kafka.layout.ConversionPattern=[%d] %p [%t] %m (%c)%n
log4j.appender.kafka.MaxFileSize=10MB
log4j.appender.kafka.MaxBackupIndex=5
log4j.appender.kafka.append=true
log4j.logger.kafka=INFO, kafka
log4j.additivity.kafka=false
log4j.logger.org.apache.kafka=INFO, kafka
log4j.additivity.org.apache.kafka=false
log4j.logger.org.apache.zookeeper=WARN, kafka
log4j.additivity.org.apache.zookeeper=false
log4j.logger.org.I0Itec.zkclient=WARN, kafka
log4j.additivity.org.I0Itec.zkclient=false
You can add additional entries and change log levels by updating these configuration files.
If you are using Ansible Playbooks for Confluent Platform, use the variable control_center_log_dir
to
write Control Center logs to a custom directory. For more information, see Ansible Playbooks for Confluent Platform.
Enable logs for Control Center¶
You set your logging configuration with a Control Center environment variable at start up. Use the following environment variable to log4j configuration:
CONTROL_CENTER_LOG4J_OPTS
To set the logging configuration for Control Center:
Set and export the
CONTROL_CENTER_LOG4J_OPTS
environment variable similar to this example:export CONTROL_CENTER_LOG4J_OPTS='-Dlog4j.configuration=file:etc/confluent-control-center/<log4j.properties>'
You must restart Control Center to apply changes to logging with an environment variable. For more information, see Restarting Control Center.
Change log levels for Control Center¶
You can change log levels to help debug issues. The following commands show how to set root logging levels to DEBUG or TRACE.
To enable debug logging, change the log level to
DEBUG
at the root level:log4j.rootLogger=DEBUG, stdout
To enable trace logging, change the root logger to
TRACE
at the root level:log4j.rootLogger=TRACE, stdout
When you are done debugging and tracing, reset the log levels back to their defaults and restart Control Center. For more information, see Restarting Control Center.