Skip to content

fix: prevent excessive log file creation on each run#1333

Open
Ricardo-M-L wants to merge 1 commit into
FoundationAgents:mainfrom
Ricardo-M-L:fix/excessive-log-file-creation
Open

fix: prevent excessive log file creation on each run#1333
Ricardo-M-L wants to merge 1 commit into
FoundationAgents:mainfrom
Ricardo-M-L:fix/excessive-log-file-creation

Conversation

@Ricardo-M-L
Copy link
Copy Markdown

Features

  • Fix Wrong creation of a large number of log files #1008: each program run created a new log file with a second-precision timestamp (e.g. 20250329143025.log), causing a large number of blank or small log files to accumulate in the logs/ directory.
  • Now uses date-based filenames (e.g. openmanus_20250329.log) so all runs on the same day append to the same file.
  • Added daily rotation at midnight and 7-day retention via loguru's built-in features.

Influence

  • Only affects app/logger.py — no changes to any other module.
  • Existing log imports (from app.logger import logger) continue to work without modification.
  • The define_log_level(name=...) parameter still works: named loggers produce files like myname_20250329.log.

Result

Before: each run creates a new timestamped log file

logs/
  20250329143025.log
  20250329143128.log
  20250329144512.log
  ...

After: one log file per day, auto-rotated and cleaned up

logs/
  openmanus_20250329.log
  openmanus_20250328.log

Other

Removed unused from datetime import datetime import.

Use date-based log filenames instead of second-precision timestamps,
so all runs on the same day write to the same file. Add daily rotation
and 7-day retention to keep the logs directory clean.

Fixes FoundationAgents#1008
@Ricardo-M-L
Copy link
Copy Markdown
Author

Friendly bump — this fork PR's workflow run is stuck on action_required (GitHub's default for first-time contributors). Could a maintainer approve the workflow so CI can report a verdict? Thanks!

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.

Wrong creation of a large number of log files

1 participant