Change debug to info logs 36/87236/1
authorPamela Dragosh <pdragosh@research.att.com>
Wed, 8 May 2019 12:24:05 +0000 (08:24 -0400)
committerPamela Dragosh <pdragosh@research.att.com>
Wed, 8 May 2019 12:24:11 +0000 (08:24 -0400)
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 <pdragosh@research.att.com>
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/OnapPolicyFinderFactory.java
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/XacmlPolicyUtils.java
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdOnapPip.java
applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java
applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/LegacyGuardTranslator.java

index 6635201..b955674 100644 (file)
@@ -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;
         }
     }
index 2a5f21f..c12aae2 100644 (file)
@@ -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<Object, Object> 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
                 //
index c1f539c..2d7386d 100644 (file)
@@ -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<Obligation> 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
index e1edb90..dd44af7 100644 (file)
@@ -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<Obligation> 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<Object>) 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<Object>) 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
index 739ccba..5336d57 100644 (file)
@@ -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;
     }
 
index 451ef7e..1dd30ec 100644 (file)
@@ -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);
index 3cbfcf7..2917aab 100644 (file)
@@ -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;
         }
         //