QPID-8081: [Broker-J] Fix rolling of log files on restart with roll daily policy


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/7d398797
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/7d398797
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/7d398797

Branch: refs/heads/7.0.x
Commit: 7d398797eb0378f5423cfc8ffef2e5b853b3750e
Parents: 90d7b41
Author: Alex Rudyy <oru...@apache.org>
Authored: Thu Feb 1 14:33:11 2018 +0000
Committer: Keith Wall <kw...@apache.org>
Committed: Fri Feb 2 12:31:56 2018 +0000

----------------------------------------------------------------------
 .../server/logging/logback/AppenderUtils.java   | 21 ++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/7d398797/broker-plugins/logging-logback/src/main/java/org/apache/qpid/server/logging/logback/AppenderUtils.java
----------------------------------------------------------------------
diff --git 
a/broker-plugins/logging-logback/src/main/java/org/apache/qpid/server/logging/logback/AppenderUtils.java
 
b/broker-plugins/logging-logback/src/main/java/org/apache/qpid/server/logging/logback/AppenderUtils.java
index af1aaae..16fd87d 100644
--- 
a/broker-plugins/logging-logback/src/main/java/org/apache/qpid/server/logging/logback/AppenderUtils.java
+++ 
b/broker-plugins/logging-logback/src/main/java/org/apache/qpid/server/logging/logback/AppenderUtils.java
@@ -126,13 +126,12 @@ public class AppenderUtils
         }
 
         @Override
-        protected void computeNextCheck()
+        public void start()
         {
-            super.computeNextCheck();
-            if (_rollOnRestart && _isFirst)
+            super.start();
+            if (_rollOnRestart)
             {
-                _isFirst = false;
-                nextCheck = 0l;
+                nextCheck = 0L;
             }
         }
 
@@ -142,12 +141,14 @@ public class AppenderUtils
             if (_rollOnRestart && _isFirst)
             {
                 _isFirst = false;
-                return activeFile.exists() && activeFile.length() != 0l;
-            }
-            else
-            {
-                return super.isTriggeringEvent(activeFile, event);
+                if (activeFile.exists() && activeFile.length() == 0)
+                {
+                    computeNextCheck();
+                    return false;
+                }
             }
+
+            return super.isTriggeringEvent(activeFile, event);
         }
 
         public FileSize getMaxFileSize()


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to