From 0768e0f6e3fe247b58c24da6bd852fad788b3384 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Wed, 8 May 2019 08:24:05 -0400 Subject: Change debug to info logs A lot of debug should really be info for logs. To assist with debugging but also really need to be there for auditing. Issue-ID: POLICY-1730 Change-Id: I5c41e056775c24797d257504e9c6495fa3127e45 Signed-off-by: Pamela Dragosh --- .../application/common/OnapPolicyFinderFactory.java | 8 ++++---- .../xacml/application/common/XacmlPolicyUtils.java | 16 ++++++++-------- .../std/StdCombinedPolicyResultsTranslator.java | 14 +++++++------- .../common/std/StdMatchableTranslator.java | 20 ++++++++++---------- .../pdp/xacml/application/common/std/StdOnapPip.java | 2 +- .../std/StdXacmlApplicationServiceProvider.java | 8 ++++---- .../pdp/application/guard/LegacyGuardTranslator.java | 8 ++++---- 7 files changed, 38 insertions(+), 38 deletions(-) (limited to 'applications') diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/OnapPolicyFinderFactory.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/OnapPolicyFinderFactory.java index 66352010..b955674c 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/OnapPolicyFinderFactory.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/OnapPolicyFinderFactory.java @@ -91,7 +91,7 @@ public class OnapPolicyFinderFactory extends PolicyFinderFactory { */ public OnapPolicyFinderFactory(Properties properties) { super(properties); - logger.debug("Constructed using properties {}", properties); + logger.info("Constructed using properties {}", properties); // // Save our properties // @@ -220,7 +220,7 @@ public class OnapPolicyFinderFactory extends PolicyFinderFactory { protected synchronized void init() { if (this.needsInit) { - logger.debug("Initializing OnapPolicyFinderFactory Properties "); + logger.info("Initializing OnapPolicyFinderFactory Properties "); // // Check for property that combines root policies into one policyset @@ -265,8 +265,8 @@ public class OnapPolicyFinderFactory extends PolicyFinderFactory { this.rootPolicies = this.getPolicyDefs(XACMLProperties.PROP_ROOTPOLICIES); } this.referencedPolicies = this.getPolicyDefs(XACMLProperties.PROP_REFERENCEDPOLICIES); - logger.debug("Root Policies: {}", this.rootPolicies.size()); - logger.debug("Referenced Policies: {}", this.referencedPolicies.size()); + logger.info("Root Policies: {}", this.rootPolicies.size()); + logger.info("Referenced Policies: {}", this.referencedPolicies.size()); this.needsInit = false; } } diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtils.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtils.java index 2a5f21f0..c12aae2c 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtils.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtils.java @@ -367,14 +367,14 @@ public class XacmlPolicyUtils { * @throws IOException If unable to read file */ public static Properties loadXacmlProperties(Path propertyPath) throws IOException { - LOGGER.debug("Loading xacml properties {}", propertyPath); + LOGGER.info("Loading xacml properties {}", propertyPath); try (InputStream is = Files.newInputStream(propertyPath)) { Properties properties = new Properties(); properties.load(is); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Loaded xacml properties {} {}", System.lineSeparator(), properties); + if (LOGGER.isInfoEnabled()) { + LOGGER.info("Loaded xacml properties {} {}", System.lineSeparator(), properties); for (Entry entrySet : properties.entrySet()) { - LOGGER.debug("{} -> {}", entrySet.getKey(), entrySet.getValue()); + LOGGER.info("{} -> {}", entrySet.getKey(), entrySet.getValue()); } } return properties; @@ -387,8 +387,8 @@ public class XacmlPolicyUtils { * @throws IOException If unable to store the file. */ public static void storeXacmlProperties(Properties properties, Path propertyPath) throws IOException { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Storing xacml properties {} {} {}", properties, System.lineSeparator(), propertyPath); + if (LOGGER.isInfoEnabled()) { + LOGGER.info("Storing xacml properties {} {} {}", properties, System.lineSeparator(), propertyPath); } try (OutputStream os = Files.newOutputStream(propertyPath)) { String strComments = "#"; @@ -443,7 +443,7 @@ public class XacmlPolicyUtils { // Get a file // Path rootPath = Paths.get(properties.getProperty(root + DOT_FILE_SUFFIX)); - LOGGER.debug("Root file {} {}", rootPath, rootPath.getFileName()); + LOGGER.info("Root file {} {}", rootPath, rootPath.getFileName()); // // Construct new path for the root policy // @@ -466,7 +466,7 @@ public class XacmlPolicyUtils { // Get a file // Path refPath = Paths.get(properties.getProperty(referenced + DOT_FILE_SUFFIX)); - LOGGER.debug("Referenced file {} {}", refPath, refPath.getFileName()); + LOGGER.info("Referenced file {} {}", refPath, refPath.getFileName()); // // Construct new path for the root policy // diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java index c1f539c4..2d7386d9 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java @@ -129,7 +129,7 @@ public class StdCombinedPolicyResultsTranslator implements ToscaPolicyTranslator @Override public Request convertRequest(DecisionRequest request) { - LOGGER.debug("Converting Request {}", request); + LOGGER.info("Converting Request {}", request); try { return RequestParser.parseRequest(StdCombinedPolicyRequest.createInstance(request)); } catch (IllegalArgumentException | IllegalAccessException | DataTypeException e) { @@ -176,9 +176,9 @@ public class StdCombinedPolicyResultsTranslator implements ToscaPolicyTranslator protected void scanObligations(Collection obligations, DecisionResponse decisionResponse) { for (Obligation obligation : obligations) { - LOGGER.debug("Obligation: {}", obligation); + LOGGER.info("Obligation: {}", obligation); for (AttributeAssignment assignment : obligation.getAttributeAssignments()) { - LOGGER.debug("Attribute Assignment: {}", assignment); + LOGGER.info("Attribute Assignment: {}", assignment); // // We care about the content attribute // @@ -188,8 +188,8 @@ public class StdCombinedPolicyResultsTranslator implements ToscaPolicyTranslator // The contents are in Json form // Object stringContents = assignment.getAttributeValue().getValue(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("DCAE contents: {}{}", System.lineSeparator(), stringContents); + if (LOGGER.isInfoEnabled()) { + LOGGER.info("DCAE contents: {}{}", System.lineSeparator(), stringContents); } // // Let's parse it into a map using Gson @@ -299,8 +299,8 @@ public class StdCombinedPolicyResultsTranslator implements ToscaPolicyTranslator // // Convert the YAML Policy to JSON Object // - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("JSON DCAE Policy {}{}", System.lineSeparator(), jsonPolicy); + if (LOGGER.isInfoEnabled()) { + LOGGER.info("JSON DCAE Policy {}{}", System.lineSeparator(), jsonPolicy); } // // Create an AttributeValue for it diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java index e1edb90b..dd44af7a 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java @@ -75,7 +75,7 @@ public class StdMatchableTranslator implements ToscaPolicyTranslator { @Override public Request convertRequest(DecisionRequest request) { - LOGGER.debug("Converting Request {}", request); + LOGGER.info("Converting Request {}", request); try { return RequestParser.parseRequest(StdMatchablePolicyRequest.createInstance(request)); } catch (IllegalArgumentException | IllegalAccessException | DataTypeException e) { @@ -89,7 +89,7 @@ public class StdMatchableTranslator implements ToscaPolicyTranslator { @Override public DecisionResponse convertResponse(Response xacmlResponse) { - LOGGER.debug("Converting Response {}", xacmlResponse); + LOGGER.info("Converting Response {}", xacmlResponse); DecisionResponse decisionResponse = new DecisionResponse(); // // Setup policies @@ -122,9 +122,9 @@ public class StdMatchableTranslator implements ToscaPolicyTranslator { protected void scanObligations(Collection obligations, DecisionResponse decisionResponse) { for (Obligation obligation : obligations) { - LOGGER.debug("Obligation: {}", obligation); + LOGGER.info("Obligation: {}", obligation); for (AttributeAssignment assignment : obligation.getAttributeAssignments()) { - LOGGER.debug("Attribute Assignment: {}", assignment); + LOGGER.info("Attribute Assignment: {}", assignment); // // We care about the content attribute // @@ -134,8 +134,8 @@ public class StdMatchableTranslator implements ToscaPolicyTranslator { // The contents are in Json form // Object stringContents = assignment.getAttributeValue().getValue(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Policy contents: {}{}", System.lineSeparator(), stringContents); + if (LOGGER.isInfoEnabled()) { + LOGGER.info("Policy contents: {}{}", System.lineSeparator(), stringContents); } // // Let's parse it into a map using Gson @@ -269,7 +269,7 @@ public class StdMatchableTranslator implements ToscaPolicyTranslator { // Find policyScope and policyType // if (entrySet.getKey().equals("policyScope")) { - LOGGER.debug("Found policyScope: {}", entrySet.getValue()); + LOGGER.info("Found policyScope: {}", entrySet.getValue()); if (entrySet.getValue() instanceof Collection) { targetType.getAnyOf().add(generateMatches((Collection) entrySet.getValue(), ToscaDictionary.ID_RESOURCE_POLICY_SCOPE_PROPERTY)); @@ -279,7 +279,7 @@ public class StdMatchableTranslator implements ToscaPolicyTranslator { } } if (entrySet.getKey().equals("policyType")) { - LOGGER.debug("Found policyType: {}", entrySet.getValue()); + LOGGER.info("Found policyType: {}", entrySet.getValue()); if (entrySet.getValue() instanceof Collection) { targetType.getAnyOf().add(generateMatches((Collection) entrySet.getValue(), ToscaDictionary.ID_RESOURCE_POLICY_TYPE_PROPERTY)); @@ -320,8 +320,8 @@ public class StdMatchableTranslator implements ToscaPolicyTranslator { // // Convert the YAML Policy to JSON Object // - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("JSON Optimization Policy {}{}", System.lineSeparator(), jsonPolicy); + if (LOGGER.isInfoEnabled()) { + LOGGER.info("JSON Optimization Policy {}{}", System.lineSeparator(), jsonPolicy); } // // Create an AttributeValue for it diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPip.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPip.java index 739ccba9..5336d572 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPip.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPip.java @@ -80,7 +80,7 @@ public abstract class StdOnapPip extends StdConfigurableEngine { @Override public void configure(String id, Properties properties) throws PIPException { super.configure(id, properties); - logger.debug("Configuring historyDb PIP {}", properties); + logger.info("Configuring historyDb PIP {}", properties); this.properties = properties; } diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java index 451ef7e1..1dd30ec4 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java @@ -107,7 +107,7 @@ public abstract class StdXacmlApplicationServiceProvider implements XacmlApplica // try { pdpProperties = XacmlPolicyUtils.loadXacmlProperties(XacmlPolicyUtils.getPropertiesPath(pathForData)); - LOGGER.debug("{}", pdpProperties); + LOGGER.info("{}", pdpProperties); } catch (IOException e) { throw new XacmlApplicationException("Failed to load xacml.propertis", e); } @@ -151,8 +151,8 @@ public abstract class StdXacmlApplicationServiceProvider implements XacmlApplica // Maybe check for an error // XACMLPolicyWriter.writePolicyFile(refPath, xacmlPolicy); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("Xacml Policy is {}{}", System.lineSeparator(), new String(Files.readAllBytes(refPath))); + if (LOGGER.isInfoEnabled()) { + LOGGER.info("Xacml Policy is {}{}", System.lineSeparator(), new String(Files.readAllBytes(refPath))); } // // Add root policy to properties object @@ -282,7 +282,7 @@ public abstract class StdXacmlApplicationServiceProvider implements XacmlApplica * @throws IOException If unable to read file */ protected synchronized Properties loadXacmlProperties() throws IOException { - LOGGER.debug("Loading xacml properties {}", pathForData); + LOGGER.info("Loading xacml properties {}", pathForData); try (InputStream is = Files.newInputStream(pathForData)) { Properties properties = new Properties(); properties.load(is); diff --git a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/LegacyGuardTranslator.java b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/LegacyGuardTranslator.java index 3cbfcf73..2917aab2 100644 --- a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/LegacyGuardTranslator.java +++ b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/LegacyGuardTranslator.java @@ -109,7 +109,7 @@ public class LegacyGuardTranslator implements ToscaPolicyTranslator { // Check if we were able to create the rule // if (rule == null) { - LOGGER.warn("Failed to create rule"); + LOGGER.error("Failed to create rule"); return null; } // @@ -124,7 +124,7 @@ public class LegacyGuardTranslator implements ToscaPolicyTranslator { @Override public Request convertRequest(DecisionRequest request) { - LOGGER.debug("Converting Request {}", request); + LOGGER.info("Converting Request {}", request); try { return RequestParser.parseRequest(LegacyGuardPolicyRequest.createInstance(request)); } catch (IllegalArgumentException | IllegalAccessException | DataTypeException e) { @@ -138,7 +138,7 @@ public class LegacyGuardTranslator implements ToscaPolicyTranslator { @Override public DecisionResponse convertResponse(Response xacmlResponse) { - LOGGER.debug("Converting Response {}", xacmlResponse); + LOGGER.info("Converting Response {}", xacmlResponse); DecisionResponse decisionResponse = new DecisionResponse(); // // Iterate through all the results @@ -280,7 +280,7 @@ public class LegacyGuardTranslator implements ToscaPolicyTranslator { // Integer limit = parseInteger(properties.get("limit").toString()); if (limit == null) { - LOGGER.debug("Must have a limit value for frequency guard policy to be created"); + LOGGER.error("Must have a limit value for frequency guard policy to be created"); return null; } // -- cgit 1.2.3-korg