In order for log files not to grow infinitely, the TimeRollingFileHandler rotates the log files based on time. In the default configuration the files are rotated each day. The file rolling interval is determined by the time component in the pattern configuration. The pattern is formed using: - the current time (%1$),
- the user home (%2$),
- temp directory (%3$) and
- var directory (%5$) as positional parameters.
The time components can be referenced by %1$tY %1$tm %1$td %1$tH %1$tM for year, month, day, hour, minutes respectively, or also as %ty %<tm %<td %<tH %<tM (< = use previous positional argument). Code Block |
---|
title | Example: Pattern that will rotate the log file each minute: |
---|
| %5$s/logs/%ty-%<tm-%<td-%<tH-%<tM/timestamp.log |
|