Skip to content

Commit ed394ca

Browse files
SoloJacobsjherbel
authored andcommitted
Add log rotation
We keep 14 days worth of log files. They are named as follows robotmk_scheduler_r00001.log robotmk_scheduler_r00002.log robotmk_scheduler_rCURRENT.log Ideally, we would use the timestamp for this, but flexi-logger uses local time for the naming, and thus this could be misleading.
1 parent b2f5adb commit ed394ca

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

v2/robotmk/src/bin/scheduler/logging.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use anyhow::Error;
22
use camino::Utf8PathBuf;
33
use flexi_logger::{
4-
DeferredNow, FileSpec, FlexiLoggerError, LogSpecification, Logger, LoggerHandle, Record,
4+
Age, Cleanup, Criterion, DeferredNow, FileSpec, FlexiLoggerError, LogSpecification, Logger,
5+
LoggerHandle, Naming, Record,
56
};
67
use log::error;
78

@@ -34,6 +35,11 @@ pub fn init(
3435
None => logger.log_to_stderr(),
3536
}
3637
.format(format)
38+
.rotate(
39+
Criterion::Age(Age::Day),
40+
Naming::Numbers,
41+
Cleanup::KeepLogFiles(14),
42+
)
3743
.start()
3844
}
3945

0 commit comments

Comments
 (0)