Open ericfreese opened 3 weeks ago
Thanks for reporting this and digging into the git history @ericfreese 🤩
At the very least, there should be documentation that describes the LOG_LEVEL_FILE
config, so I've opened this docs issue: https://github.com/dbt-labs/docs.getdbt.com/issues/6404
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: https://github.com/dbt-labs/dbt-core/pull/10949
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:
https://github.com/dbt-labs/dbt-core/blob/dd77210756e6432ef2737ab59a65c238e3abfdda/core/dbt/events/logging.py#L95
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 a2213abbc0ba932ab164160ce98f8b2c63e74d5c