You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
I ran into this while deploying DBT core in an environment where dbt's current working directory is not writeable. I had set DBT_LOG_PATH to a separate writeable directory, but then realized recently that we actually want to entirely disable DBT's file logging because we store the stdout/stderr output separately.
After some digging through the source (because I couldn't find documentation of how to disable the file logging), I found this line:
A bit more digging and I found that I could set a DBT_LOG_LEVEL_FILE=none environment variable to effectively disable the file logging. I figured that after disabling file logging, I would no longer need to set DBT_LOG_PATH so I removed that environment variable.
Upon testing, I was surprised to see that dbt debug now provided no output and only exited with error code 2. I'd run into this issue before when it couldn't open the log file for writing, so I added DBT_LOG_PATH=/tmp back to the environment, and it ran successfully.
Expected Behavior
It seems to me that if file logging is disabled, dbt should not try to make the logging directory.
Steps To Reproduce
In an environment where DBT cannot make a directory in its current working directory (you may also be able to make the mkdir fail by creating logs as a regular file rather than a directory e.g. touch logs)
With env vars:
DBT_TARGET_PATH=/tmp # or some writeable directory
DBT_PACKAGES_DIR=/tmp # or some writeable directory
DBT_LOG_LEVEL_FILE=none
Run dbt debug
See no output and exit code 2 (via echo $?)
Instead, I would expect dbt debug to succeed and print its output. Nothing should be logged to the file system.
I dug back through the git history a bit and I think the make_log_dir_if_missing call should have been moved under the if statement when the none option was added in commit a2213ab
The text was updated successfully, but these errors were encountered:
I don't think we ever intentionally designed or documented dbt to not create a logging directory in this scenario, so I'm going to switch this to a feature request for further consideration for your PR: #10949
dbeatty10
changed the title
[Bug] DBT tries to create a log directory even when file logging is disabled
[Feature] Skip creating a log directory when file logging is disabled
Nov 1, 2024
Is this a new bug in dbt-core?
Current Behavior
I ran into this while deploying DBT core in an environment where dbt's current working directory is not writeable. I had set
DBT_LOG_PATH
to a separate writeable directory, but then realized recently that we actually want to entirely disable DBT's file logging because we store the stdout/stderr output separately.After some digging through the source (because I couldn't find documentation of how to disable the file logging), I found this line:
dbt-core/core/dbt/events/logging.py
Line 95 in dd77210
A bit more digging and I found that I could set a
DBT_LOG_LEVEL_FILE=none
environment variable to effectively disable the file logging. I figured that after disabling file logging, I would no longer need to setDBT_LOG_PATH
so I removed that environment variable.Upon testing, I was surprised to see that
dbt debug
now provided no output and only exited with error code 2. I'd run into this issue before when it couldn't open the log file for writing, so I addedDBT_LOG_PATH=/tmp
back to the environment, and it ran successfully.Expected Behavior
It seems to me that if file logging is disabled, dbt should not try to make the logging directory.
Steps To Reproduce
mkdir
fail by creatinglogs
as a regular file rather than a directory e.g.touch logs
)dbt debug
echo $?
)Instead, I would expect
dbt debug
to succeed and print its output. Nothing should be logged to the file system.Relevant log output
No response
Environment
Which database adapter are you using with dbt?
postgres
Additional Context
I dug back through the git history a bit and I think the
make_log_dir_if_missing
call should have been moved under the if statement when thenone
option was added in commit a2213abThe text was updated successfully, but these errors were encountered: