You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by fa...@apache.org on 2019/01/18 02:49:35 UTC

[zookeeper] branch master updated: ZOOKEEPER-3232: make the log of notification about LE more readable

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

fangmin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new fd465eb  ZOOKEEPER-3232: make the log of notification about LE more readable
fd465eb is described below

commit fd465ebf5380319b0ec9415ab832b01046e131ff
Author: maoling <ma...@sina.com>
AuthorDate: Fri Jan 18 10:49:12 2019 +0800

    ZOOKEEPER-3232: make the log of notification about LE more readable
    
    - The first PR of the NEW YEAR:2019.good luck to me(:D).
    - More details in [ZOOKEEPER-3232](https://issues.apache.org/jira/browse/ZOOKEEPER-3232)
    
    Author: maoling <ma...@sina.com>
    
    Reviewers: fangmin@apache.org, evolivelli@apche.org
    
    Closes #749 from maoling/ZOOKEEPER-3232
---
 .../zookeeper/server/quorum/FastLeaderElection.java      | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/FastLeaderElection.java b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/FastLeaderElection.java
index 9ebdabd..439f5b0 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/FastLeaderElection.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/FastLeaderElection.java
@@ -711,16 +711,12 @@ public class FastLeaderElection implements Election {
         }
     }
 
-    private void printNotification(Notification n){
-        LOG.info("Notification: "
-                + Long.toHexString(n.version) + " (message format version), "
-                + n.leader + " (n.leader), 0x"
-                + Long.toHexString(n.zxid) + " (n.zxid), 0x"
-                + Long.toHexString(n.electionEpoch) + " (n.round), " + n.state
-                + " (n.state), " + n.sid + " (n.sid), 0x"
-                + Long.toHexString(n.peerEpoch) + " (n.peerEPoch), "
-                + self.getPeerState() + " (my state)"
-                + (n.qv!=null ? (Long.toHexString(n.qv.getVersion()) + " (n.config version)"):""));
+    private void printNotification(Notification n) {
+        LOG.info("Notification: my state:{}; n.sid:{}, n.state:{}, n.leader:{}, n.round:0x{}, " +
+                        "n.peerEpoch:0x{}, n.zxid:0x{}, message format version:0x{}, n.config version:0x{}",
+                self.getPeerState(), n.sid, n.state, n.leader, Long.toHexString(n.electionEpoch),
+                Long.toHexString(n.peerEpoch), Long.toHexString(n.zxid), Long.toHexString(n.version),
+                (n.qv != null ? (Long.toHexString(n.qv.getVersion())) : "0"));
     }