From 3557b257aaf8f260956458993a678b88a062068b Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 3 Sep 2021 10:15:32 -0400 Subject: Reduce coder verbosity in logs 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 --- .../drools/protocol/coders/GenericEventProtocolCoder.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/GenericEventProtocolCoder.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/GenericEventProtocolCoder.java index 8c734d52..0729c706 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/GenericEventProtocolCoder.java +++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/GenericEventProtocolCoder.java @@ -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() + + "]"; + } } -- cgit 1.2.3-korg