Improve Mastership logging

Logs only meaningful mastership changes

Change-Id: Ibbe4f85526df01b3c1b6eab317a2c15716098d80
diff --git a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/client/StreamClientImpl.java b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/client/StreamClientImpl.java
index 5d227e4..5c64a0c 100644
--- a/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/client/StreamClientImpl.java
+++ b/protocols/p4runtime/ctl/src/main/java/org/onosproject/p4runtime/ctl/client/StreamClientImpl.java
@@ -181,12 +181,21 @@
                         ARBITRATION_RETRY_SECONDS, TimeUnit.SECONDS);
             } else {
                 // Send now.
-                log.info("Setting mastership on {}... " +
-                                 "master={}, newElectionId={}, " +
-                                 "masterElectionId={}, sessionOpen={}",
-                         deviceId, requestedToBeMaster.get(),
-                         pendingElectionId, masterElectionId,
-                         streamChannelManager.isOpen());
+                if (log.isDebugEnabled()) {
+                    log.debug("Setting mastership on {}... " +
+                                    "master={}, newElectionId={}, " +
+                                    "masterElectionId={}, sessionOpen={}",
+                            deviceId, requestedToBeMaster.get(),
+                            pendingElectionId, masterElectionId,
+                            streamChannelManager.isOpen());
+                } else if (!pendingElectionId.equals(lastUsedElectionId)) {
+                    log.info("Setting mastership on {}... " +
+                                    "master={}, newElectionId={}, " +
+                                    "masterElectionId={}, sessionOpen={}",
+                            deviceId, requestedToBeMaster.get(),
+                            pendingElectionId, masterElectionId,
+                            streamChannelManager.isOpen());
+                }
                 // Optimistically set the reported master status, if wrong, it
                 // will be updated by the arbitration response. This alleviates
                 // race conditions when calling isMaster() right after setting