"task-log" RollingFile Appender
This appender manages scheduled task logs with automatic file rotation.
Configuration example:
xml
<RollingFile name="task-log" fileName="logs/tasks.log" filePattern="logs/tasks-%d{yyyy-MM-dd}.log">
<ThresholdFilter level="DEBUG"/>
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss},%m%n"/>
<Policies>
<SizeBasedTriggeringPolicy size="1000KB"/>
</Policies>
<DefaultRolloverStrategy max="100"/>
</RollingFile>
The task log is a CSV-type log. It differs from other logs as it only takes a snapshot of the scheduled tasks' state at a given time T. It can be used to analyze system load but cannot show all tasks that have been executed. Each log line format consists of 4 sections and 10 columns. Taking the following example, here's the explanation of each column:
xml
2025-01-28 15:43:54,1,0,,5,1,2025-01-28 15:43:43,10,0,
Log details:
2025-01-28 15:43:54
: Snapshot date and time- Section for high priority tasks
- Section for medium priority tasks
- Section for low priority tasks
Column details:
2025-01-28 15:43:54
: Snapshot date and time1
: Identifier indicating the low priority tasks section (1 = Low priority, 5 = Medium priority, 10 = High priority)0
: Number of low priority tasks currently running- `` : Date and time of the oldest low priority task not yet executed
5
: Identifier indicating the medium priority tasks section (1 = Low priority, 5 = Medium priority, 10 = High priority)1
: Number of medium priority tasks currently running2025-01-28 15:43:43
: Date and time of the oldest medium priority task not yet executed10
: Identifier indicating the high priority tasks section (1 = Low priority, 5 = Medium priority, 10 = High priority)0
: Number of high priority tasks currently running- `` : Date and time of the oldest high priority task not yet executed
Basic Configuration
- Name:
task-log
- Output file:
logs/tasks.log
- Archive file pattern:
logs/tasks-[DATE].log
Log Format
The pattern %d{yyyy-MM-dd HH:mm:ss},%m%n
defines the following format:
%d{yyyy-MM-dd HH:mm:ss}
: Date and time in specified format,
: Separator (comma)%m
: Log message%n
: Line break
Rotation Policy
- SizeBasedTriggeringPolicy: 1000KB (1MB) per file
- DefaultRolloverStrategy: Maximum 100 archive files
- Rotation creates a new file when:
- Current file reaches 1MB
- A new day begins (based on date pattern)
Filter
- ThresholdFilter: Minimum level DEBUG
- All messages of level DEBUG or higher will be recorded
- Format particularly suitable for:
- Export to analysis tools (CSV-like format)
- Historical analysis with significant retention (100 files)