Do not flood logs with modifications 58/58758/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 7 Jun 2017 16:40:52 +0000 (18:40 +0200)
committerTom Pantelis <tompantelis@gmail.com>
Mon, 12 Jun 2017 18:11:54 +0000 (18:11 +0000)
Debugging logs have grown quite a bit for tell-based protocol
mostly due to us dumping modifications as part of the request
message. Log only the number of modification in the message,
which will make the logs quite a bit more readable.

Change-Id: I35961702b7bdd0e3f93cd03f05a0e443a14bf419
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 11b30d7680da427f78188dd841c5d6509c12ef33)

opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/ModifyTransactionRequest.java
opendaylight/md-sal/cds-access-api/src/test/java/org/opendaylight/controller/cluster/access/commands/ModifyTransactionRequestEmptyTest.java
opendaylight/md-sal/cds-access-api/src/test/java/org/opendaylight/controller/cluster/access/commands/ModifyTransactionRequestTest.java

index 0f01ee5..30dac62 100644 (file)
@@ -50,7 +50,8 @@ public final class ModifyTransactionRequest extends TransactionRequest<ModifyTra
 
     @Override
     protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
-        return super.addToStringAttributes(toStringHelper).add("operations", modifications).add("protocol", protocol);
+        return super.addToStringAttributes(toStringHelper).add("modifications", modifications.size())
+                .add("protocol", protocol);
     }
 
     @Override
index 692c661..099567f 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster.access.commands;
 
 import com.google.common.base.MoreObjects;
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
 import org.junit.Assert;
@@ -19,7 +19,7 @@ public class ModifyTransactionRequestEmptyTest extends AbstractTransactionReques
     private static final PersistenceProtocol PROTOCOL = PersistenceProtocol.ABORT;
 
     private static final ModifyTransactionRequest OBJECT = new ModifyTransactionRequest(
-            TRANSACTION_IDENTIFIER, 0, ACTOR_REF, Lists.newArrayList(), PROTOCOL);
+            TRANSACTION_IDENTIFIER, 0, ACTOR_REF, new ArrayList<>(), PROTOCOL);
 
     @Override
     protected ModifyTransactionRequest object() {
@@ -43,7 +43,7 @@ public class ModifyTransactionRequestEmptyTest extends AbstractTransactionReques
     @Test
     public void addToStringAttributesTest() {
         final MoreObjects.ToStringHelper result = OBJECT.addToStringAttributes(MoreObjects.toStringHelper(OBJECT));
-        Assert.assertTrue(result.toString().contains("operations=" + Lists.newArrayList()));
+        Assert.assertTrue(result.toString().contains("modifications=0"));
         Assert.assertTrue(result.toString().contains("protocol=" + PROTOCOL));
     }
 
index 35514ea..4e32c4a 100644 (file)
@@ -55,7 +55,7 @@ public class ModifyTransactionRequestTest extends AbstractTransactionRequestTest
     @Test
     public void addToStringAttributesTest() {
         final MoreObjects.ToStringHelper result = OBJECT.addToStringAttributes(MoreObjects.toStringHelper(OBJECT));
-        Assert.assertTrue(result.toString().contains("operations=" + MODIFICATIONS));
+        Assert.assertTrue(result.toString().contains("modifications=1"));
         Assert.assertTrue(result.toString().contains("protocol=" + PROTOCOL));
     }
 

©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.