-
Notifications
You must be signed in to change notification settings - Fork 677
All About Logs
Diwaker Gupta edited this page Jun 2, 2023
·
5 revisions
The stacks-node
binary output logs to stderr
(vs. stdout
). To easily capture / pipe / filter logs (e.g. using tools like tee
), redirect stderr
to stdout
. In bash
, this is accomplished with 2>&1
, like so:
$ stacks-node start --config follower.toml 2>&1 | tee info-logs.txt`
By default, the log level is set to INFO
. To enable debug logging, set the environment variable STACKS_LOG_DEBUG=1
.
$ STACKS_LOG_DEBUG=1 stacks-node start --config follower.toml 2>&1 | tee info-logs.txt`
To set the log-level to TRACE
, set STACKS_LOG_TRACE=1
instead.
First, you must compile stacks-node
with the slog_json
feature enabled, like so:
$ cargo build -F slog_json -p stacks-node --bin stacks-node
Once enabled, set the environment variable STACKS_LOG_JSON=1
:
$ STACKS_LOG_JSON=1 stacks-node check-config --config follower.toml 2>&1 | jq .
{
"msg": "stacks-node 0.1.0 (chore/logs:a93c2867d+, debug build, macos [aarch64])",
"level": "INFO",
"ts": "2023-06-02T16:54:04.377153Z",
"thread": "main",
"line": 82,
"file": "testnet/stacks-node/src/main.rs"
}