A logging sink for file, which supports log file rotation and daily log files.
More...
A logging sink for file, which supports log file rotation and daily log files.
Based on the settings mFileRotationDepth, mDailyLogFiles and mDailyLogFileStart, this log sink will create log files according the following scheme:
mFileRotationDepth = 0:
mDailyLogFiles = false:
- Log file naming scheme:
- Overwrites the log file at each start.
mDailyLogFiles = true:
- Log file naming scheme:
logFilePrefix_YYYY-MM-DD.log
- The log file will contain all messages starting at the specified time (
mDailyLogFileStart) of the day. Log messages before this time will be written into the file of the day before.
- If the log sink is started multiple times (e.g. multiple starts on one day), the log messages will be appended to the already existing log file.
mFileRotationDepth > 0:
mDailyLogFiles = false:
- Log file naming scheme:
logFilePrefix.log (current start)
logFilePrefix.log.1 (log of one start ago)
logFilePrefix.log.2 (log of two starts ago)
- Creates a new log file for each start, until
mFileRotationDepth is reached. Older log files will be deleted.
mDailyLogFiles = true:
- Log file naming scheme:
logFilePrefix_YYYY-MM-DD.log (current day)
logFilePrefix_YYYY-MM-(DD-1).log (one day ago)
logFilePrefix_YYYY-MM-(DD-2).log (two days ago)
- This mode creates a new log file starting at the specified time (
mDailyLogFileStart) of the day. Log messages before this time will be written into the file of the day before.
- The log file which is
mFileRotationDepth+1 days old, will be deleted.
- If the log sink is started multiple times (e.g. multiple starts on one day), the log messages will be appended to the already existing log file.
mFileRotationDepth < 0:
- Same behaviour as
mFileRotationDepth > 0, but unlimited number of files. Use carefully!
By default, log file rotation and daily log files are disabled. The default daily log file start is midnight.
- Note
- Using the same logFilePrefix with different settings (especially different values of
mFileRotationDepth) might cause an unexpected behaviour, since for performance reasons only the file mFileRotationDepth+1 will be checked and deleted. Older files will not be touched.