Moment For Technology

Druid How to enable log query

Posted on April 3, 2023, 1:55 a.m. by 張雅惠
Category: The back-end Tag: The back-end

By default, Druid does not enable log query.

In other words, data queried in Druid does not show up in Druid's logs, and one of the problems with this is that there is no way for Druid to get queries in the background.

This article focuses on showing query logs in logs.


Druid log to use slf4j, so you need to modify the properties file for: common. Runtime. Properties

This file is located at the Druid deployment path:


In the configuration file above, add a property:


Configuration log4j2. XML

The log4j2.xml log configuration file is in the same path as the Druid deployment.

The main change here is the log level. Most of the time you may set the log level to ERROR. The output of the query log is in the log level INFO.

Therefore, you need to change your Root log level to INFO. If you are not familiar with log levels, please refer to the log4j2 configuration.

After completing the above configuration, restart the Druid service you deployed and you should be able to see what the query request is.

At the end of the log you should be able to see what the specific query SQL is, and in Druid you can also use JSON format for queries.

About (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.