Logs
Log Formatting
dbt outputs logs to two different locations: CLI console and the log file.
dbt --log-format json run
The text
format is the default for console logs and has plain text messages prefixed with a simple timestamp:
23:30:16 Running with dbt=1.8.0
23:30:17 Registered adapter: postgres=1.8.0
The debug
format is the default for the log file and is the same as the text
format but with a more detailed timestamp and also includes the invocation_id
, thread_id
, and log level of each message:
============================== 16:12:08.555032 | 9089bafa-4010-4f38-9b42-564ec9106e07 ==============================
16:12:08.555032 [info ] [MainThread]: Running with dbt=1.8.0
16:12:08.751069 [info ] [MainThread]: Registered adapter: postgres=1.8.0
The json
format outputs fully structured logs in the JSON format:
{"data": {"log_version": 3, "version": "=1.8.0"}, "info": {"category": "", "code": "A001", "extra": {}, "invocation_id": "82131fa0-d2b4-4a77-9436-019834e22746", "level": "info", "msg": "Running with dbt=1.8.0", "name": "MainReportVersion", "pid": 7875, "thread": "MainThread", "ts": "2024-05-29T23:32:54.993336Z"}}
{"data": {"adapter_name": "postgres", "adapter_version": "=1.8.0"}, "info": {"category": "", "code": "E034", "extra": {}, "invocation_id": "82131fa0-d2b4-4a77-9436-019834e22746", "level": "info", "msg": "Registered adapter: postgres=1.8.0", "name": "AdapterRegistered", "pid": 7875, "thread": "MainThread", "ts": "2024-05-29T23:32:56.437986Z"}}
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
...
Log and target paths
By default, dbt will write logs to a directory named logs/
, and all other artifacts to a directory named target/
. Both of those directories are located relative to dbt_project.yml
of the active project.
Just like other global configs, it is possible to override these values for your environment or invocation by using CLI options (--target-path
, --log-path
) or environment variables (DBT_TARGET_PATH
, DBT_LOG_PATH
).
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 thanERROR
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