Skip to content

Fix log cleanup for bare relative log paths - #306

Open
benthecarman wants to merge 1 commit into
lightningdevkit:mainfrom
benthecarman:fix-53-bare-log-path-retention
Open

benthecarman wants to merge 1 commit into
lightningdevkit:mainfrom
benthecarman:fix-53-bare-log-path-retention

Conversation

@benthecarman

@benthecarman benthecarman commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

When the log file is set to a bare file name such as ldk-server.log, Path::parent() returns an empty path. cleanup_old_logs passed that to fs::read_dir, which fails, so rotated archives were never deleted and log_max_files had no effect.

An empty parent now means the current working directory. That is the directory the log file itself is opened in.

Found by Project Loupe

When the log file is configured as a bare file name such as
`ldk-server.log`, its parent is an empty path. Passing that to
`read_dir` fails, so rotated archives were never removed and
`log_max_files` had no effect. Treat an empty parent as the current
working directory, which is where the log file itself is opened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ldk-reviews-bot

ldk-reviews-bot commented Oct 7, 2026 •

Copy link
Copy Markdown

I've assigned @valentinewallace as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

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.

2 participants