Implement daily log rotation with improved log management #1541
+39
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements automatic daily log rotation and improves the default log location for pgcli.
Changes
1. Daily Log Rotation
TimedRotatingFileHandlerpgcli.YYYY-MM-DD.log2. Improved Default Log Location
/var/log/pgcli/pgcli.log(system-wide logging)~/.config/pgcli/logif user lacks system permissions3. Updated Documentation
pgclircconfiguration file with new log behaviorchangelog.rstTechnical Details
Before:
~/.config/pgcli/logAfter:
pgcli.YYYY-MM-DD.logFiles Modified
pgcli/main.py: Addedlogging.handlersimport and updatedinitialize_logging()functionpgcli/pgclirc: Updated log_file documentationchangelog.rst: Added entry for log rotation featureTesting
Tested manually:
Backward Compatibility
log_filesettings in config will continue to work as beforeBenefits
/var/loglocation when possibleMade with ❤️ and 🤖 Claude Code