`evaluateOnStartup="true"` saves logs under wrong file names after missing scheduled roll
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
- #4450 de @GChuf — cerrado sin fusionar
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 30/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Java
- Estrellas
- 3.6k
- Forks
- 1.8k
- Merge medio
- 5 d 6 h
- PR fusionados (30 d)
- 24
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/logging-log4j2
-
additivity attributeAbiertowaiting-for-maintainer
Dificultad 2/5 1-3 horas Aptitud para principiantes 63/100
apache/logging-log4j2#4475 ·
Los mantenedores suelen responder en 1 día
-
Migrate `log4j-api-test` tests to JUnit 5Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertoapi priority: P3 tests waiting-for-maintainer
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/logging-log4j2#4430 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
`Rfc5424Layout` does not escape the `newLineEscape` replacement in SD-PARAM-VALUEPosiblemente ocupada @lunarbae628 la tomó hace 5 días. Abiertobug layouts priority: P3
apache/logging-log4j2#4464 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
configuration enhancement layouts
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
apache/logging-log4j2#4463 ·
Los mantenedores suelen responder en 1 día
-
`PluginBuilder` reads builder fields that `GraalVmProcessor` does not register, so `LevelMatchFilter`, `SystemPropertyArbiter` and others fail in GraalVM native imagesPosiblemente ocupada @typat la tomó hace 13 días. Abiertobug graalvm plugins priority: P2 waiting-for-maintainer
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
apache/logging-log4j2#4441 ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/logging-log4j2
Issues similares
-
[Bug]: Nullable implicit operator on string extensible enums still throws for a null stringPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertobug emitter:client:csharp
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
microsoft/typespec#12572 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
[BUG]: Java SDK MountRequest always sends update-optional fields, resetting stored mount settingsAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
Los mantenedores suelen responder en 1 día
-
[Bug] RemotingHelper.connect swaps the socket send and receive buffer configurationPosiblemente ocupada @amalsaidov la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
needs-area-label
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días