Logging
Druid uses log4j2 for logging. The default configuration file log4j2.xml ships with Druid under conf/druid/{config}/_common/log4j2.xml .
By default, Druid uses RollingRandomAccessFile
for rollover daily, and keeps log files up to 7 days. If that’s not suitable in your case, you could modify the log4j2.xml to meet your need.
An example log4j2.xml file is shown below:
The included log4j2.xml configuration for Druid and ZooKeeper will output logs to the log
directory at the root of the distribution.
If you want to change the log directory, set the environment variable to the right directory before you start Druid.
The secondary log file (for example, log/historical.stdout.log
) contains anything that is written by the component directly to standard output or standard error without going through log4j2. This consists mainly of messages from the Java runtime itself. This file is not rotated, but it is generally small due to the low volume of messages. If necessary, you can truncate it using the Linux command .
On Java 11, you may see warnings like this in log files:
To avoid these, add the --add-exports
and --add-opens
command line parameters described in the documentation section about Java strong encapsulation.