From 68e1f7d4c54429caa74441c7444ef1fe0f75867c Mon Sep 17 00:00:00 2001 From: David Mollitor Date: Mon, 3 Feb 2020 04:30:41 +0100 Subject: [PATCH] ZOOKEEPER-3708: Move Logging Code into Logging Guard in Learner Author: David Mollitor Reviewers: eolivelli@apache.org, andor@apache.org Closes #1240 from belugabehr/ZOOKEEPER-3708 --- .../java/org/apache/zookeeper/server/quorum/Learner.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Learner.java b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Learner.java index e34ab3cede3..0f8f444a672 100644 --- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Learner.java +++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Learner.java @@ -217,11 +217,11 @@ void readPacket(QuorumPacket pp) throws IOException { leaderIs.readRecord(pp, "packet"); messageTracker.trackReceived(pp.getType()); } - long traceMask = ZooTrace.SERVER_PACKET_TRACE_MASK; - if (pp.getType() == Leader.PING) { - traceMask = ZooTrace.SERVER_PING_TRACE_MASK; - } if (LOG.isTraceEnabled()) { + final long traceMask = + (pp.getType() == Leader.PING) ? ZooTrace.SERVER_PING_TRACE_MASK + : ZooTrace.SERVER_PACKET_TRACE_MASK; + ZooTrace.logQuorumPacket(LOG, traceMask, 'i', pp); } }