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 log4j2 properties
file that the tools use.
- Create a copy of the
log4j2.properties
file that the tools
use.You are free to change the location where the copy gets created.
cp /etc/kafka/conf/tools-log4j2.properties /var/tmp
- Open the copied file and change the value of the
root.logger
property as required.For
example:
root.logger=TRACE,console
- Pass the location of the newly created properties file as a JVM
parameter.
You can do this by adding
-Dlog4j2.configurationFile=file:[PATH_TO_FILE]
to
the
KAFKA_OPTS
variable. For
example:
export KAFKA_OPTS="-Dlog4j2.configurationFile=file:/var/tmp/tools-log4j2.properties"
The specified logging level is configured.