Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Old log files are not removed if rCURRENT doesn't overflow #38

Closed
ghost opened this issue Jan 26, 2020 · 3 comments
Closed

Old log files are not removed if rCURRENT doesn't overflow #38

ghost opened this issue Jan 26, 2020 · 3 comments
Labels

Comments

@ghost
Copy link

ghost commented Jan 26, 2020

When a FileLogWriterState is created, it sometimes rotate_output_file_to_date but does not call remove_or_zip_too_old_logfiles. The latter is only called when an existing _rCURRENT overflows. Therefore when a downstream program is run repeatedly, but doesn't generate enough log messages to trigger mount_next_linewriter_if_necessary in a single run, old rCURRENT messages can accumulate indefinitely in the log directory.

@emabee
Copy link
Owner

emabee commented Jan 27, 2020

Thanks for reporting, I'll check ASAP. May I ask for your Logger configuration (as far as relevant)?

@emabee emabee added the bug label Jan 27, 2020
@ghost
Copy link
Author

ghost commented Jan 27, 2020

Below is a configuration that replicates the issue:

Logger::with_str("info")
        .log_to_file()
        .directory("log_files")
        .rotate(
            Criterion::Size(8192),
            Naming::Timestamps,
            Cleanup::KeepLogFiles(3),
        )
        .start()
        .unwrap();

When only a small amount of log messages are generated in the lifetime of a program, the procedure to clean up previous log files is not triggered, so log files keep accumulating. When the clean-up procedure is triggered in any single run that generates enough log messages, the old log files are removed to comply with Cleanup::KeepLogFiles(u64).

@emabee
Copy link
Owner

emabee commented Jan 28, 2020

Fixed with 0.14.6. Thanks for reporting!

@emabee emabee closed this as completed Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant