Skip to content

Commit

Permalink
Rollover + backup for dbt.log (#4405)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcohen6 committed Dec 2, 2021
1 parent 1c5c853 commit 506dc93
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/dbt/events/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ def setup_event_logger(log_path, level_override=None):

file_passthrough_formatter = logging.Formatter(fmt=FORMAT)

file_handler = RotatingFileHandler(filename=log_dest, encoding='utf8')
file_handler = RotatingFileHandler(
filename=log_dest,
encoding='utf8',
maxBytes=10 * 1024 * 1024, # 10 mb
backupCount=5
)
file_handler.setFormatter(file_passthrough_formatter)
file_handler.setLevel(logging.DEBUG) # always debug regardless of user input
this.FILE_LOG.handlers.clear()
Expand Down

0 comments on commit 506dc93

Please sign in to comment.