From 897412483a6838a4315113d0797c2bf943b789b3 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 8 Feb 2026 15:52:56 -0800 Subject: [PATCH] Use RotatingFileHandler to prevent unbounded log file growth The current FileHandler allows log files to grow indefinitely, which can consume significant disk space (100+ GB observed in long-running sessions). This change switches to RotatingFileHandler with: - 5 MB max file size - 3 backup files retained This limits total log storage to ~20 MB per session while preserving recent logs for debugging. --- src/util/log_setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/log_setup.py b/src/util/log_setup.py index 1879e51..565215d 100644 --- a/src/util/log_setup.py +++ b/src/util/log_setup.py @@ -143,11 +143,13 @@ def setup_logging(manager): "stream": "ext://sys.stdout", }, "file": { - "class": "logging.FileHandler", + "class": "logging.handlers.RotatingFileHandler", "encoding": "utf-8", "filename": log_path, "level": "DEBUG" if manager.get_debug() else "INFO", "formatter": "millisecondFormatter", + "maxBytes": 5 * 1024 * 1024, # 5 MB + "backupCount": 3, }, }, "loggers": {