Output file name provided with the -l option gets suffixed automatically with _YYYYMMDD_HH or _YYYYMMDD string, respectively. If the given base file name has an extension suffix starting with a dot, then the extension is moved to the end of the resulting filename. That is, supplying -l /home/pi/acars.log -D options produces a filename of /home/pi/acars_YYYYMMDD.log instead of /home/pi/acars.log_YYYYMMDD. If neither -H nor -D option is used, the program behaves the old way.
An additional change is when the -o 0 option is given together with -l <output_file>, then the output file is not opened nor created at all.
This feature simplifies log file management and archiving by avoiding periodic program restarts, when rotation is required.
This patch adds two command line options:
-H
- rotates the output file on top of every hour-D
- rotates the output file at midnightOutput file name provided with the
-l
option gets suffixed automatically with_YYYYMMDD_HH
or_YYYYMMDD
string, respectively. If the given base file name has an extension suffix starting with a dot, then the extension is moved to the end of the resulting filename. That is, supplying-l /home/pi/acars.log -D
options produces a filename of/home/pi/acars_YYYYMMDD.log
instead of/home/pi/acars.log_YYYYMMDD
. If neither-H
nor-D
option is used, the program behaves the old way.An additional change is when the
-o 0
option is given together with-l <output_file>
, then the output file is not opened nor created at all.This feature simplifies log file management and archiving by avoiding periodic program restarts, when rotation is required.