From 9f5ac4f9aacfe3066cceb3106e57cb52343ff0f8 Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Fri, 22 Sep 2017 15:41:07 +0200 Subject: Add different log in AbstractModelElement Log changed when the Json attribute value is null or empty Change-Id: Ie0321efbbcc7f9c637f1bd8ea44001e5036987d3 Issue-ID: CLAMP-54 Signed-off-by: Determe, Sebastien (sd378r) --- .../clamp/clds/model/prop/AbstractModelElement.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/main/java/org/onap') diff --git a/src/main/java/org/onap/clamp/clds/model/prop/AbstractModelElement.java b/src/main/java/org/onap/clamp/clds/model/prop/AbstractModelElement.java index a7dd5cbf0..7038dc6cf 100644 --- a/src/main/java/org/onap/clamp/clds/model/prop/AbstractModelElement.java +++ b/src/main/java/org/onap/clamp/clds/model/prop/AbstractModelElement.java @@ -37,8 +37,8 @@ import java.util.List; * ...) */ public abstract class AbstractModelElement { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(AbstractModelElement.class); - protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); + protected static final EELFLogger logger = EELFManager.getInstance().getLogger(AbstractModelElement.class); + protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); private final String type; private final ModelBpmn modelBpmn; @@ -49,6 +49,9 @@ public abstract class AbstractModelElement { private final ModelProperties modelProp; + private static final String LOG_ELEMENT = "Value '"; + private static final String LOG_NOT_FOUND = "' for key 'name' not found in JSON"; + /** * Perform base parsing of properties for a ModelElement (such as, * Collector, StringMatch, Policy and Tca) @@ -116,9 +119,9 @@ public abstract class AbstractModelElement { } } if (value == null || value.length() == 0) { - logger.warn(name + "=" + value); + logger.warn(LOG_ELEMENT + name + LOG_NOT_FOUND); } else { - logger.debug(name + "=" + value); + logger.debug(LOG_ELEMENT + name + LOG_NOT_FOUND + nodeIn.toString()); } return value; } @@ -137,9 +140,9 @@ public abstract class AbstractModelElement { value = nodeIn.path(name).asText(); } if (value == null || value.length() == 0) { - logger.warn(name + "=" + value); + logger.warn(LOG_ELEMENT + name + LOG_NOT_FOUND); } else { - logger.debug(name + "=" + value); + logger.debug(LOG_ELEMENT + name + LOG_NOT_FOUND + nodeIn.toString()); } return value; } @@ -206,9 +209,9 @@ public abstract class AbstractModelElement { } } if (values == null || values.isEmpty()) { - logger.warn(name + "=" + values); + logger.warn(LOG_ELEMENT + name + LOG_NOT_FOUND); } else { - logger.debug(name + "=" + values); + logger.debug(LOG_ELEMENT + name + LOG_NOT_FOUND + nodeIn.toString()); } return values; } -- cgit 1.2.3-korg