Configuring log levels for command line tools

Learn how to change the logging level of command line tools.

In some cases it can prove useful to change the default logging level of the command line tools. This can be done by setting the required logging level in the log4j properties file that the tools use.
  1. Create a copy of the log4j.properties file that the tools use.
    You are free to change the location where the copy gets created.
    cp /etc/kafka/conf/tools-log4j.properties /var/tmp
  2. Open the copied file and change the value of the root.logger property as required.
    For example:
    root.logger=TRACE,console
  3. Pass the location of the newly created properties file as a JVM parameter.
    You can do this by adding -Dlog4j.configuration=file:[PATH_TO_FILE] to the KAFKA_OPTS variable. For example:
    export KAFKA_OPTS="-Dlog4j.configuration=file:/var/tmp/tools-log4j.properties"
    
The specified logging level is configured.