`evaluateOnStartup="true"` saves logs under wrong file names after missing scheduled roll
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #4450 của @GChuf — đã đóng, không merge
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 30/100
Hướng nghiên cứu
The bug is in how CronTriggeringPolicy with evaluateOnStartup computes the rollover filename; the debug log shows RollingFileManager running a synchronous FileRenameAction with the current minute instead of the file's own period. Start by tracing the startup evaluation path from CronTriggeringPolicy into RollingFileManager. Done means a missed rollover archives under the file's own period name and a test with a missed schedule covers it. Pull request #4450 is already open against this issue, so check it before starting.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
CronTriggeringPolicy with evaluateOnStartup="true" archives a file from an earlier period under the current period's filename when a scheduled rollover was missed (e.g. the application was offline at the previous fire time). The next scheduled rollover archives under the same name and overwrites that archive, losing log data.
In essence - the filename is wrong and log data can be lost.
Configuration
Version: 2.26.1
Operating system: Ubuntu 22
JDK: openjdk version "17.0.20.1"
Logs
# Restart at 12:50:49: file from 12:48:26, rollovers at 12:49 and 12:50 were missed
2026-11-02T11:50:49.528038115Z main DEBUG Returning file creation time for .../log/artemis.log
2026-11-02T11:50:49.529010771Z main DEBUG Setting prev file time to 2026-11-02T12:48:26.000+0100
2026-11-02T11:50:49.530286817Z main DEBUG LastRollForFile 2026-11-02T12:48:00.000+0100, LastRegularRole 2026-11-02T12:50:00.000+0100
(2026-11-02T12:48:26.000+0100), lastRollForFile=prevFire(fileTime)=2026-11-02T12:48:00.000+0100, lastRegularRoll=prevFire(now)=2026-11-02T12:50:00.000+0100, lastRollForFile.before(lastRegularRoll)=true
# Startup rollover archives the 12:48 file under the current minute (12:50)
2026-11-02T11:50:49.537060282Z main DEBUG RollingFileManager executing synchronous FileRenameAction[.../log/artemis.log to .../log/artemis.log.2026-11-02-12-50, renameEmptyFiles=false]
2026-11-02T11:50:49.537880477Z main DEBUG Now writing to .../log/artemis.log at 2026-11-02T12:50:49.537+0100
2026-11-02T11:50:49.539007046Z main DEBUG Log4j2 ConfigurationScheduler scheduled cron expression 0 * * * * ? to fire at 2026-11-02T12:51:00.000+0100
Reproduction
Use cron schedule 0 * * * * to test rolling every minute, to reproduce and speed up the tests.
evaluateOnStartup must be true.
config:
appender.log_file.filePattern = /var/log/logFile.log.%d{yyyy-MM-dd-HH-mm}
appender.log_file.policies.cron.schedule = 0 * * * * ?
appender.log_file.policies.cron.evaluateOnStartup = true
- delete logFile.log, start the software at 12:48:26 (before 12:49:00) and keep producing log content. A new log is created, with lines from 12:48:26 onward
- stop the software before 12:49:00, so the scheduled rollovers at 12:49:00 and 12:50:00 are missed
- start the software again at 12:50:49. The file is rolled over on startup, but archived as logFile.log.2026-11-02-12-50 (the current minute) instead of logFile.log.2026-11-02-12-48 (the file's own minute). It contains the logs from 12:48:26 until the software was stopped
- logFile.log is now empty, and lines from after 12:50:49 start appearing
- at 12:51:00 the scheduled rollover also archives as logFile.log.2026-11-02-12-50, overwriting the file from startup. The data from 12:48:26 until the stop is lost
- Ngôn ngữ chính
- Java
- Star
- 3.6k
- Fork
- 1.8k
- Merge trung bình
- 5 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 24
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/logging-log4j2
-
additivity attributeĐang mởwaiting-for-maintainer
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
apache/logging-log4j2#4475 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Migrate `log4j-api-test` tests to JUnit 5Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởapi priority: P3 tests waiting-for-maintainer
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/logging-log4j2#4430 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`Rfc5424Layout` does not escape the `newLineEscape` replacement in SD-PARAM-VALUECó thể đã có người làm @lunarbae628 đã nhận 5 ngày trước. Đang mởbug layouts priority: P3
apache/logging-log4j2#4464 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
configuration enhancement layouts
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
apache/logging-log4j2#4463 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`PluginBuilder` reads builder fields that `GraalVmProcessor` does not register, so `LevelMatchFilter`, `SystemPropertyArbiter` and others fail in GraalVM native imagesCó thể đã có người làm @typat đã nhận 13 ngày trước. Đang mởbug graalvm plugins priority: P2 waiting-for-maintainer
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
apache/logging-log4j2#4441 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/logging-log4j2
Issue tương tự
-
[FEATURE] Expose external refresh, node-level translog and warmer statsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởuntriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
opensearch-project/opensearch-prometheus-exporter#680 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
-
Good First Issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
hiero-ledger/hiero-sdk-java#3059 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug live-tv platform:desktop platform:mobile platform:tv
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
fk0u/cleanyourtv-tahoe#102 ·
Maintainer thường phản hồi trong vòng 1 ngày