diff options
author | Smokowski, Kevin (ks6305) <kevin.smokowski@att.com> | 2019-09-05 20:10:01 +0000 |
---|---|---|
committer | Smokowski, Kevin (ks6305) <kevin.smokowski@att.com> | 2019-09-05 20:10:01 +0000 |
commit | be5c33c26dae1ff3c9ae353f2dfa76e976a909be (patch) | |
tree | 44b11b6349cde189893039baf7704ced364f3d23 | |
parent | 78a590a49f7eae65e6aa569cb6e1759a230f71cf (diff) |
logging changes
remove old logging statements, add a few helpful ones
Issue-ID: CCSDK-1665
Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Change-Id: I2272f54b447647c8beab6d2053413c57e816eeac
16 files changed, 49 insertions, 119 deletions
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java index 87e8f1a4..94ffcd99 100644 --- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java +++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java @@ -193,10 +193,9 @@ public class SvcLogicDblibStore implements SvcLogicStore { } else { return null; } - } catch (SQLException e) { - throw new ConfigurationException("SQL query failed", e); } catch (Exception e) { - throw new ConfigurationException("Graph processing failed", e); + LOG.error("Graph processing failed", e); + throw new ConfigurationException("Graph processing failed: " + e.getMessage()); } finally { try { if (fetchGraphStmt != null) { diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExprListener.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExprListener.java index 185986d8..a1871951 100644 --- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExprListener.java +++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExprListener.java @@ -79,7 +79,6 @@ public class SvcLogicExprListener extends ExprGrammarBaseListener private void pushExpr(SvcLogicExpression expr) { - LOG.trace("Pushing expression ["+expr.getClass().getName()+"]"); if (curExpr != null) { exprStack.push(curExpr); diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionFactory.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionFactory.java index d275e970..9e9bfe0d 100644 --- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionFactory.java +++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionFactory.java @@ -42,7 +42,6 @@ public class SvcLogicExpressionFactory { public static SvcLogicExpression parse(String exprStr) throws IOException { - LOG.trace("parse("+exprStr+")"); InputStream exprStream = new ByteArrayInputStream(exprStr.getBytes()); CharStream input = new ANTLRInputStream(exprStream); ExprGrammarLexer lexer = new ExprGrammarLexer(input); diff --git a/sli/features/features-sli/src/main/feature/feature.xml b/sli/features/odl-sli/src/main/feature/feature.xml index f8ecf8d6..2304d931 100644 --- a/sli/features/features-sli/src/main/feature/feature.xml +++ b/sli/features/odl-sli/src/main/feature/feature.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="ccsdk-dblib"> - <feature name="features-sli" description="ccsdk-sli-core :: sli :: features-sli" version="${project.version}"> + <feature name="ccsdk-sli"> <!-- the generated bundle symbolic name is very long for wrapped jars, providing an instruction to shorten it --> - <bundle>wrap:mvn:org.onap.ccsdk.sli.core/sli-provider-base/${project.version}$Bundle-SymbolicName=org.onap.ccsdk.sli.core.sli-provider.base</bundle> + <bundle>wrap:mvn:org.onap.ccsdk.sli.core/sli-provider-base/${project.version}/$Bundle-SymbolicName=org.onap.ccsdk.sli.core.sli-provider-base&Bundle-Name=sli-provider-base</bundle> </feature> </features> diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java index a51accbb..9bab745b 100644 --- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java @@ -21,9 +21,15 @@ package org.onap.ccsdk.sli.core.sli.provider.base; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicExpression; import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; import org.onap.ccsdk.sli.core.sli.SvcLogicNode; import org.onap.ccsdk.sli.core.sli.SvcLogicRecorder; @@ -36,6 +42,8 @@ public abstract class AbstractSvcLogicNodeExecutor { public abstract SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException; private static final Logger LOG = LoggerFactory.getLogger(AbstractSvcLogicNodeExecutor.class); + protected static final String PARAMETER_DEBUG_PATTERN = "Parameter: {} resolves to: {} which came from the expression: {}"; + protected static final String SETTING_DEBUG_PATTERN = "Setting context attribute: {} to: {} which came from the expression: {}"; protected String evaluateNodeTest(SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { @@ -90,4 +98,23 @@ public abstract class AbstractSvcLogicNodeExecutor { return (nextNode); } + protected Map<String, String> getResolvedParameters(SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException{ + Map<String, String> parmMap = new HashMap<>(); + + Set<Map.Entry<String, SvcLogicExpression>> parmSet = node + .getParameterSet(); + + for (Iterator<Map.Entry<String, SvcLogicExpression>> iter = parmSet + .iterator(); iter.hasNext();) { + Map.Entry<String, SvcLogicExpression> curEnt = iter.next(); + String curName = curEnt.getKey(); + SvcLogicExpression curExpr = curEnt.getValue(); + String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, node, ctx); + LOG.trace(PARAMETER_DEBUG_PATTERN, curName, curExprValue, curExpr.toString()); + parmMap.put(curName,curExprValue); + } + + return parmMap; + } + } diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java index 5d6a0839..55afa859 100644 --- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java @@ -63,24 +63,12 @@ public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor { String key = SvcLogicExpressionResolver.evaluate( node.getAttribute("key"), node, ctx); - Map<String, String> parmMap = new HashMap<>(); - - Set<Map.Entry<String, SvcLogicExpression>> parmSet = node - .getParameterSet(); boolean hasParms = false; - - for (Iterator<Map.Entry<String, SvcLogicExpression>> iter = parmSet - .iterator(); iter.hasNext();) { - hasParms = true; - Map.Entry<String, SvcLogicExpression> curEnt = iter.next(); - String curName = curEnt.getKey(); - SvcLogicExpression curExpr = curEnt.getValue(); - String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, node, ctx); - - LOG.debug("Parameter "+curName+" = "+curExpr.asParsedExpr()+" resolves to "+curExprValue); - - parmMap.put(curName,curExprValue); - } + + Map<String, String> parmMap = getResolvedParameters(node,ctx); + if(!parmMap.isEmpty()) { + hasParms = true; + } if (hasParms) { SvcLogicAdaptor.ConfigStatus confStatus = SvcLogicAdaptor.ConfigStatus.FAILURE; diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java index cef582b7..0fe179b7 100644 --- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java @@ -79,23 +79,8 @@ public class ExecuteNodeExecutor extends AbstractSvcLogicNodeExecutor { } else { try { - Map<String, String> parmMap = new HashMap<>(); - - Set<Map.Entry<String, SvcLogicExpression>> parmSet = node - .getParameterSet(); - - for (Iterator<Map.Entry<String, SvcLogicExpression>> iter = parmSet - .iterator(); iter.hasNext();) { - Map.Entry<String, SvcLogicExpression> curEnt = iter.next(); - String curName = curEnt.getKey(); - SvcLogicExpression curExpr = curEnt.getValue(); - String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, node, ctx); - - LOG.trace("Parameter "+curName+" = "+curExpr.asParsedExpr()+" resolves to "+curExprValue); - - parmMap.put(curName,curExprValue); - } + Map<String, String> parmMap = getResolvedParameters(node,ctx); Object o = pluginMethod.invoke(plugin, parmMap, ctx); String emitsOutcome = SvcLogicExpressionResolver.evaluate(node.getAttribute("emitsOutcome"), node, ctx); diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/RecordNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/RecordNodeExecutor.java index be5462bd..d233a36d 100644 --- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/RecordNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/RecordNodeExecutor.java @@ -46,27 +46,7 @@ public class RecordNodeExecutor extends AbstractSvcLogicNodeExecutor { String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); String outValue = "failure"; - if (LOG.isTraceEnabled()) { - LOG.trace(node.getNodeType() + " node encountered - looking for recorder class " + plugin); - } - - Map<String, String> parmMap = new HashMap<>(); - - Set<Map.Entry<String, SvcLogicExpression>> parmSet = node.getParameterSet(); - boolean hasParms = false; - - for (Iterator<Map.Entry<String, SvcLogicExpression>> iter = parmSet.iterator(); iter.hasNext();) { - hasParms = true; - Map.Entry<String, SvcLogicExpression> curEnt = iter.next(); - String curName = curEnt.getKey(); - SvcLogicExpression curExpr = curEnt.getValue(); - String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, node, ctx); - - if (LOG.isTraceEnabled()) { - LOG.trace("executeRecordNode : parameter " + curName + " = " + curExpr + " => " + curExprValue); - } - parmMap.put(curName, curExprValue); - } + Map<String, String> parmMap = getResolvedParameters(node,ctx); SvcLogicRecorder recorder = getSvcLogicRecorder(plugin); if (recorder != null) { diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReturnNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReturnNodeExecutor.java index d2fe35d7..ab284e5a 100644 --- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReturnNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReturnNodeExecutor.java @@ -66,8 +66,7 @@ public class ReturnNodeExecutor extends AbstractSvcLogicNodeExecutor { curEnt.getValue(), node, ctx); if (LOG.isDebugEnabled()) { - LOG.debug("Setting context attribute " + curName + " to " - + curValue); + LOG.debug(SETTING_DEBUG_PATTERN, curName, curValue); } ctx.setAttribute(curName, curValue); } diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SaveNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SaveNodeExecutor.java index f8595fff..64a44b3b 100644 --- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SaveNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SaveNodeExecutor.java @@ -54,24 +54,7 @@ public class SaveNodeExecutor extends AbstractSvcLogicNodeExecutor { boolean force = "true".equalsIgnoreCase(forceStr); boolean localOnly = "true".equalsIgnoreCase(localOnlyStr); - Map<String, String> parmMap = new HashMap<>(); - - Set<Map.Entry<String, SvcLogicExpression>> parmSet = node.getParameterSet(); - boolean hasParms = false; - - for (Iterator<Map.Entry<String, SvcLogicExpression>> iter = parmSet.iterator(); iter.hasNext();) { - hasParms = true; - Map.Entry<String, SvcLogicExpression> curEnt = iter.next(); - String curName = curEnt.getKey(); - SvcLogicExpression curExpr = curEnt.getValue(); - if (curExpr != null) { - String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, node, ctx); - - LOG.debug("Parameter " + curName + " = " + curExpr.asParsedExpr() + " resolves to " + curExprValue); - - parmMap.put(curName, curExprValue); - } - } + Map<String, String> parmMap = getResolvedParameters(node,ctx); String outValue = FAILURE; diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SetNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SetNodeExecutor.java index caf0015b..89074362 100644 --- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SetNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SetNodeExecutor.java @@ -169,8 +169,7 @@ public class SetNodeExecutor extends AbstractSvcLogicNodeExecutor { String curValue = SvcLogicExpressionResolver.evaluate(curEnt.getValue(), node, ctx); if (LOG.isDebugEnabled()) { - LOG.trace("Parameter value {} resolves to {}", curEnt.getValue().asParsedExpr(), curValue); - LOG.debug("Setting context attribute {} to {}", lhsVarName, curValue); + LOG.debug(SETTING_DEBUG_PATTERN, lhsVarName, curValue, curEnt.getValue().toString()); } ctx.setAttribute(lhsVarName, curValue); } diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicExpressionResolver.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicExpressionResolver.java index 59ba6cd7..e3c0ef20 100644 --- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicExpressionResolver.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicExpressionResolver.java @@ -44,6 +44,7 @@ public class SvcLogicExpressionResolver { private static final Logger LOG = LoggerFactory .getLogger(SvcLogicExpressionResolver.class); private static final String INVALID_EXPRESSION_MSG= "Invalid expression ("; + private static final String EXPRESSION_DEBUG_PATTERN = "Expression: {} resolves to {}: which has the value {}"; public static String evaluate(SvcLogicExpression expr, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { @@ -51,8 +52,6 @@ public class SvcLogicExpressionResolver { return (null); } - - if (expr instanceof SvcLogicAtom) { SvcLogicAtom atom = (SvcLogicAtom) expr; @@ -75,15 +74,18 @@ public class SvcLogicExpressionResolver { LOG.trace("Context variable $"+varName+" unset - treating as empty string"); varValue = ""; } - + LOG.trace(EXPRESSION_DEBUG_PATTERN,expr.toString(),varName,varValue); return (varValue); } SvcLogicExpression parm = node.getParameter(varName); if (parm != null) { - return (evaluate(parm, node, ctx)); + String value = evaluate(parm, node, ctx); + LOG.trace(EXPRESSION_DEBUG_PATTERN,expr.toString(),varName,value); + return value; } else { + LOG.trace(EXPRESSION_DEBUG_PATTERN,expr.toString(),varName,varName); return(varName); } default: @@ -98,7 +100,6 @@ public class SvcLogicExpressionResolver { List<SvcLogicExpression> operands = binExpr.getOperands(); if (operands.size() == 1) { - LOG.trace("SvcLogicBinaryExpression as no operator and one operand - evaluating its operand"); return(evaluate(operands.get(0), node, ctx)); } else diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceImplBase.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceImplBase.java index 5d6843f9..361ca708 100644 --- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceImplBase.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceImplBase.java @@ -122,11 +122,7 @@ public class SvcLogicServiceImplBase implements SvcLogicServiceBase { return (null); } - LOG.info("About to execute node # {} ({})", node.getNodeId(), node.getNodeType()); - - if (LOG.isDebugEnabled()) { - LOG.debug("Executing node " + node.getNodeId() + " of " + node.getGraph().getRpc()); - } + LOG.info("About to execute node #{} {} node in graph {}", node.getNodeId(), node.getNodeType(), node.getGraph().toString()); AbstractSvcLogicNodeExecutor executor = nodeExecutors.get(node.getNodeType()); diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/UpdateNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/UpdateNodeExecutor.java index 3d93a37e..104f36f5 100644 --- a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/UpdateNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/UpdateNodeExecutor.java @@ -49,24 +49,7 @@ public class UpdateNodeExecutor extends AbstractSvcLogicNodeExecutor { String pfx = SvcLogicExpressionResolver.evaluate(node.getAttribute("pfx"), node, ctx); - Map<String, String> parmMap = new HashMap<>(); - - Set<Map.Entry<String, SvcLogicExpression>> parmSet = node.getParameterSet(); - boolean hasParms = false; - - for (Iterator<Map.Entry<String, SvcLogicExpression>> iter = parmSet.iterator(); iter.hasNext();) { - hasParms = true; - Map.Entry<String, SvcLogicExpression> curEnt = iter.next(); - String curName = curEnt.getKey(); - SvcLogicExpression curExpr = curEnt.getValue(); - if (curExpr != null) { - String curExprValue = SvcLogicExpressionResolver.evaluate(curExpr, node, ctx); - - LOG.debug("Parameter " + curName + " = " + curExpr.asParsedExpr() + " resolves to " + curExprValue); - - parmMap.put(curName, curExprValue); - } - } + Map<String, String> parmMap = getResolvedParameters(node,ctx); String outValue = "failure"; diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java index 3b6151c9..5bd4bd93 100755 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java @@ -342,15 +342,8 @@ public class MdsalHelper { // "getValue", then // set value identified by "prefix" to that one value. if ((numGetters == 1) && ("getValue".equals(lastGetterName))) { - LOG.trace("getValueFIX : " + propNamePfx + " only has getValue() getter - setting " + propNamePfx - + " = " + propVal); props.setProperty(propNamePfx, propVal); - } else { - LOG.trace("getValueFIX : " + propNamePfx + " has " + numGetters + " getter(s), last one found was " - + lastGetterName); - } - } else { // Class is not yang generated and not a list // It must be an element of a leaf list - set "prefix" to value diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java index d5c7f3bf..f563d986 100755 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java @@ -94,7 +94,6 @@ public class SvcLogicServiceImpl extends SvcLogicServiceImplBase implements SvcL @Override public Properties execute(String module, String rpc, String version, String mode, Properties props, DOMDataBroker domDataBroker) throws SvcLogicException { - LOG.info("Fetching service logic from data store"); SvcLogicGraph graph = store.fetch(module, rpc, version, mode); if (graph == null) { |