Fundamentals
Logs

Logs

To better understand the state of your node, you will likely want to enable or disable certain logging levels at launch. We have provided several ways to deeply inspect the logs of your client.

Logging Options

When running your node, you can customize the logging behavior using the following options:

  • -l, --log <LOG_PATTERN>...: Sets a custom logging filter. Syntax is <target>=<level>, e.g. -lsync=debug. Log levels (least to most verbose) are error, warn, info, debug, and trace. By default, all targets log info. The global log level can be set with -l<level>.
  • --detailed-log-output: Enable detailed log output. This includes displaying the log target, log level, and thread name. This is automatically enabled when something is logged with any higher level than info.
  • --disable-log-color: Disable log color output.
  • --enable-log-reloading: Enable feature to dynamically update and reload the log filter. Be aware that enabling this feature can lead to a performance decrease up to a factor of six or more. Depending on the global logging level, the performance decrease changes. The system_addLogFilter and system_resetLogFilter RPCs will have no effect with this option not being set.
  • --tracing-targets <TARGETS>: Sets a custom profiling filter. Syntax is the same as for logging: <target>=<level>.
  • --tracing-receiver <RECEIVER>: Receiver to process tracing messages. [default: log]

Docker Logs

If you started your node in a Docker container, you can check its logs using the following command:

sudo docker logs <container_name>

When running your node in a Docker container, you can configure Rust logging using the RUST_LOG environment variable. For debugging purposes, set it when you start the container:

sudo docker run --name madara [...] -e RUST_LOG=<log_level> kss/madara:latest

This command allows you to view the logs in real-time and obtain detailed information about your node's operation.

Source Logs

If you are running your node directly from the source, you can configure the logs by setting the RUST_LOG environment variable before launching your application. For example:

export RUST_LOG=<log_level>
cargo run --release

This will control the verbosity of the log messages generated by your application. The following log levels are supported, from most to least verbose:

trace
debug
info  # default
warn
error

By following these instructions, you should be able to configure and manage the logs of your Madara node effectively.