Skip to content

Use RotatingFileHandler to prevent unbounded log file growth#58

Open
ContinualDissapointment wants to merge 1 commit intoandroidWG:mainfrom
ContinualDissapointment:fix/log-rotation
Open

Use RotatingFileHandler to prevent unbounded log file growth#58
ContinualDissapointment wants to merge 1 commit intoandroidWG:mainfrom
ContinualDissapointment:fix/log-rotation

Conversation

@ContinualDissapointment
Copy link
Copy Markdown

Summary

The current FileHandler allows log files to grow indefinitely, which can consume significant disk space. I observed 150+ GB of log files after extended use.

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.

Changes

  • src/util/log_setup.py: Replace logging.FileHandler with logging.handlers.RotatingFileHandler

Test plan

  • Verified logs rotate correctly when exceeding 5 MB
  • Confirmed backup files (.log.1, .log.2, .log.3) are created
  • Existing delete_old_logs() regex already handles rotated file naming

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant