BUG-9028: log stack traces on lastApplied changes 50/64150/4
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 22 Aug 2017 18:29:18 +0000 (20:29 +0200)
committerMichael Vorburger <vorburger@redhat.com>
Mon, 23 Oct 2017 14:12:42 +0000 (14:12 +0000)
This patch improves logging so we can turn up stack traces
if we ever uncounter lastApplied change shifts.

Change-Id: I4391c0580171a0edc9c93cb41aa56b3eb9cbb521
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContextImpl.java

index 4644a2d..2296eab 100644 (file)
@@ -188,7 +188,8 @@ public class RaftActorContextImpl implements RaftActorContext {
 
     @Override
     public void setLastApplied(long lastApplied) {
-        log.debug("{}: Moving last applied index from {} to {}", id, this.lastApplied, lastApplied);
+        final Throwable stackTrace = log.isTraceEnabled() ? new Throwable() : null;
+        log.debug("{}: Moving last applied index from {} to {}", id, this.lastApplied, lastApplied, stackTrace);
         this.lastApplied = lastApplied;
     }
 
@@ -202,11 +203,13 @@ public class RaftActorContextImpl implements RaftActorContext {
         return replicatedLog;
     }
 
-    @Override public ActorSystem getActorSystem() {
+    @Override
+    public ActorSystem getActorSystem() {
         return context.system();
     }
 
-    @Override public Logger getLogger() {
+    @Override
+    public Logger getLogger() {
         return this.log;
     }
 

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.