risingwave_rt

Function init_risingwave_logger

source
pub fn init_risingwave_logger(settings: LoggerSettings)
Expand description

Init logger for RisingWave binaries.

§Environment variables to configure logger dynamically

§RUST_LOG

Overrides default level and tracing targets of the fmt layer (formatting and logging to stdout or stderr).

Note that only verbosity levels below or equal to DEBUG are effective in release builds.

e.g.,

RUST_LOG="info,risingwave_stream=debug,events=debug"

§RW_QUERY_LOG_PATH

Configures the path to generate query log.

If it is set,

  • Dump logs of all SQLs, i.e., tracing target PGWIRE_QUERY_LOG to RW_QUERY_LOG_PATH/query.log.
  • Dump slow queries, i.e., tracing target PGWIRE_SLOW_QUERY_LOG to RW_QUERY_LOG_PATH/slow_query.log.

Note: To enable query log in the fmt layer (slow query is included by default), set

RUST_LOG="pgwire_query_log=info"

RW_QUERY_LOG_TRUNCATE_LEN configures the max length of the SQLs logged in the query log, to avoid the log file growing too large. The default value is 1024 in production.

§ENABLE_PRETTY_LOG

If it is set to true, enable pretty log output, which contains line numbers and prints spans in multiple lines. This can be helpful for development and debugging.

Hint: Also turn off other uninteresting logs to make the most of the pretty log. e.g.,

RUST_LOG="risingwave_storage::hummock::event_handler=off,batch_execute=off,risingwave_batch::task=off" ENABLE_PRETTY_LOG=true risedev d