Closed ghost closed 4 years ago
Thanks for reporting, I'll check ASAP. May I ask for your Logger configuration (as far as relevant)?
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)
.
Fixed with 0.14.6. Thanks for reporting!
When a
FileLogWriterState
is created, it sometimesrotate_output_file_to_date
but does not callremove_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 triggermount_next_linewriter_if_necessary
in a single run, oldrCURRENT
messages can accumulate indefinitely in the log directory.