Logs
Log Formatting
The LOG_FORMAT
config specifies how dbt's logs should be formatted. If the value of this config is json
, dbt will output fully structured logs in JSON format; otherwise, it will output text-formatted logs that are sparser for the CLI and more detailed in logs/dbt.log
.
dbt --log-format json run
{"code": "A001", "data": {"v": "=1.0.0"}, "invocation_id": "1193e449-4b7a-4eb1-8e8e-047a8b3b7973", "level": "info", "log_version": 1, "msg": "Running with dbt=1.0.0", "node_info": {}, "pid": 35098, "thread_name": "MainThread", "ts": "2021-12-03T10:46:59.928217Z", "type": "log_line"}
Use json
formatting value in conjunction with the DEBUG
config to produce rich log information which can be piped into monitoring tools for analysis:
dbt --debug --log-format json run
See structured logging for more details.
Debug-level logging
The DEBUG
config redirects dbt's debug logs to standard output. This has the effect of showing debug-level log information in the terminal in addition to the logs/dbt.log
file. This output is verbose.
The --debug
flag is also available via shorthand as -d
.
dbt --debug run
...
Suppress non-error logs in output
By default, dbt shows all logs in standard out (stdout). You can use the QUIET
config to show only error logs in stdout. Logs will still include the output of anything passed to the print()
macro. For example, you might suppress all but error logs to more easily find and debug a jinja error.
config:
quiet: true
Supply the -q
or --quiet
flag to dbt run
to show only error logs and suppress non-error logs.
dbt --quiet run
...
dbt list logging
In dbt version 1.5, we updated the logging behavior of the dbt list command to include INFO
level logs by default.
You can use either of these parameters to ensure clean output that's compatible with downstream processes, such as piping results to jq
, a file, or another process:
dbt --log-level warn list
(recommended; equivalent to previous default)dbt --quiet list
(suppresses all logging less than ERROR level, except for "printed" messages and list output)
Logging relational cache events
The LOG_CACHE_EVENTS
config allows detailed logging for relational cache events, which are disabled by default.
dbt --log-cache-events compile