Closed longzou closed 2 months ago
You need to use log_to_file
to tell flexi_logger
that it should write its output to files, and which files this should be. Only then will the rotation config become relevant.
PS: flexi_logger
does not use different types for its builder - this could be used to e.g. enable use of rotate
only if log_to_file
was used before; the compiler would then help to avoid such issues. Earlier attempts of doing so resulted in an API doc that was much harder to read, so I abdicated it.
The logger's configure as below:
Logger::with(logger_builder.build()).format(fmt) .adaptive_format_for_stdout(flexi_logger::AdaptiveFormat::WithThread) .cleanup_in_background_thread(true) .append() .print_message() .rotate(flexi_logger::Criterion::Size(8196), flexi_logger::Naming::Timestamps, flexi_logger::Cleanup::KeepLogFiles(5)) .write_mode(write_mode);
The log files was not removed during the app running.