Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only try to create log directory if file logging is enabled #10949

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20241030-130239.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're considering this a feature rather than a fix, so could you make this update?

Suggested change
kind: Fixes
kind: Features

body: Don't try to create the log directory when file logging is disabled
time: 2024-10-30T13:02:39.206813142-06:00
custom:
Author: ericfreese
Issue: "10948"
3 changes: 2 additions & 1 deletion core/dbt/events/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def _logfile_filter(log_cache_events: bool, line_format: LineFormat, msg: EventM

def setup_event_logger(flags, callbacks: List[Callable[[EventMsg], None]] = []) -> None:
cleanup_event_logger()
make_log_dir_if_missing(flags.LOG_PATH)
event_manager = get_event_manager()
event_manager.callbacks = callbacks.copy()
add_callback_to_manager(track_behavior_change_warn)
Expand All @@ -93,6 +92,8 @@ def setup_event_logger(flags, callbacks: List[Callable[[EventMsg], None]] = [])
add_logger_to_manager(console_config)

if flags.LOG_LEVEL_FILE != "none":
make_log_dir_if_missing(flags.LOG_PATH)

# create and add the file logger to the event manager
log_file = os.path.join(flags.LOG_PATH, "dbt.log")
log_file_format = _line_format_from_str(flags.LOG_FORMAT_FILE, LineFormat.DebugText)
Expand Down
Loading