Ok, so next logger question…
Is there a built-in way (or 3rd party Shard) to have a logger alternate which file it logs to? If not, I have some ideas of how I might implement this, but figured I’d ask around first…
One scenario I’ve seen is that you start with something like app.1.log
, then goes with app.2.log
, and continues cycling up thru app.X.log
, then loops back around to app.1.log
.
In other words:
(a) Include a log loop counter or a timestamp in the filename (as a prefix, postfix, or midfix), e.g.:
- like:
my_log.1.log
andmy_log.2.log
, or01.my.log
, ormy.log.001
, etc
(b) Alternate through X log files
(c) When some condition is met (e.g.: log file size or line count or etc), then it will
- For counter-named log files, it will cycle back to the first log file and replaces that older file with the new log contents; and proceed likewise when it is ready to go to the next log file in the cycle.
- For timestamp-named log files, it will start a new log file, optionally erasing old log files (older than X files or some relative timestamp)