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 directory at the root of the distribution.

    If you want to change the log directory, set the environment variable DRUID_LOG_DIR 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 truncate --size 0 log/historical.stdout.log.

    On Java 11, you may see warnings like this in log files:

    These messages do not cause harm, but you can avoid them by adding the following lines to your files. These lines are not part of the default JVM configs that ship with Druid, because Java 8 will not recognize these options and will fail to start up.