Reduce coder verbosity in logs 72/123872/3
authorJim Hahn <jrh3@att.com>
Fri, 3 Sep 2021 14:15:32 +0000 (10:15 -0400)
committerJim Hahn <jrh3@att.com>
Fri, 3 Sep 2021 14:44:17 +0000 (10:44 -0400)
After switching to lombok ToString, the log messages for the coder class
have become very long.  Switched back to the original toString() method,
which only logs the keysets rather than the whole content of the coder
maps.
Left the other additions of lombok ToString in drools-pdp as is, because
they all looked appropriate, upon further review.

Addressed review comments:
- added comment about why lombok isn't used

Issue-ID: POLICY-3397
Change-Id: I08ea8c49908b33fc3b8c8ba6de4ac4bd1474660a
Signed-off-by: Jim Hahn <jrh3@att.com>
policy-management/src/main/java/org/onap/policy/drools/protocol/coders/GenericEventProtocolCoder.java

index 8c734d5..0729c70 100644 (file)
@@ -27,7 +27,6 @@ import java.util.List;
 import java.util.Map;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
-import lombok.ToString;
 import org.onap.policy.drools.controller.DroolsController;
 import org.onap.policy.drools.controller.DroolsControllerConstants;
 import org.onap.policy.drools.protocol.coders.EventProtocolCoder.CoderFilters;
@@ -38,7 +37,6 @@ import org.slf4j.LoggerFactory;
  * This protocol Coder that does its best attempt to decode/encode, selecting the best class and best fitted json
  * parsing tools.
  */
-@ToString
 @NoArgsConstructor(access = AccessLevel.PROTECTED)
 abstract class GenericEventProtocolCoder {
     private static final String INVALID_ARTIFACT_ID_MSG = "Invalid artifact id";
@@ -720,4 +718,17 @@ abstract class GenericEventProtocolCoder {
         }
         return droolsControllers;
     }
+
+    /*
+     * Note: this only logs the KEYSETS, thus lombok ToString annotation is not used.
+     * Otherwise, it results in too much verbosity.
+     */
+    @Override
+    public String toString() {
+        return "GenericEventProtocolCoder [coders="
+                + coders.keySet()
+                + ", reverseCoders="
+                + reverseCoders.keySet()
+                + "]";
+    }
 }