You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2023/01/03 01:11:53 UTC

[logging-log4j2] branch master updated: LOG4J2-3357 - use time trigger was scheduled to fire instead of current time.

This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/master by this push:
     new 3f05b48147 LOG4J2-3357 - use time trigger was scheduled to fire instead of current time.
3f05b48147 is described below

commit 3f05b48147fd83c13286a9a0491e1263a8deea41
Author: Ralph Goers <rg...@apache.org>
AuthorDate: Mon Jan 2 18:11:45 2023 -0700

    LOG4J2-3357 - use time trigger was scheduled to fire instead of current time.
---
 .../logging/log4j/core/appender/rolling/CronTriggeringPolicy.java    | 3 ++-
 src/changes/changes.xml                                              | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/CronTriggeringPolicy.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/CronTriggeringPolicy.java
index c1cf63dd01..1e7bbc663d 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/CronTriggeringPolicy.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/CronTriggeringPolicy.java
@@ -147,7 +147,8 @@ public final class CronTriggeringPolicy extends AbstractTriggeringPolicy {
     }
 
     private void rollover() {
-		manager.rollover(cronExpression.getPrevFireTime(new Date()).getTime(), lastRollDate.getTime());
+        Date rollTime = future != null ? future.getFireTime() : new Date();
+		manager.rollover(cronExpression.getPrevFireTime(rollTime).getTime(), lastRollDate.getTime());
         if (future != null) {
             lastRollDate = future.getFireTime();
         }
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b87c3cfbc9..9f4153ba8d 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -201,7 +201,10 @@
         Fixes incorrect constructor call in LocalizedMessageFactory.
       </action>
     </release>
-    <release version="2.19.1" date="TBD" description="GA Release 2.19.1">
+    <release version="2.20.0" date="TBD" description="GA Release 2.20.0">
+      <action issue="LOG4J2-3357" dev="rgoers" type="fix">
+        Use time trigger was expected to fire instead of current time.
+      </action>
       <action issue="LOG4J2-2297" dev="rgoers" type="fix">
         Allow java.sql.Time objects to format properly in MapMessages.
       </action>