From 580141f7cf72d4a120722fc7b870dfc5c3017ced Mon Sep 17 00:00:00 2001 From: sebdet Date: Wed, 1 Apr 2020 00:00:37 +0200 Subject: Rework the logs Rework the logs so that it's easier to debug the issues on a lab Issue-ID: CLAMP-804 Signed-off-by: sebdet Change-Id: I9cff98205c2135a759e7e6156ab39f8af8129927 --- .../clds/config/DefaultUserConfiguration.java | 2 +- .../loop/components/external/DcaeComponent.java | 10 + .../loop/components/external/PolicyComponent.java | 23 +- src/main/resources/META-INF/resources/swagger.html | 6 +- src/main/resources/application-noaaf.properties | 1 + src/main/resources/application.properties | 2 +- .../resources/clds/camel/rest/clamp-api-v2.xml | 435 +++++++++++++++------ src/main/resources/logback-default.xml | 103 +++-- src/main/resources/logback-spring.xml | 19 + src/main/resources/logback.xml | 19 - src/test/resources/logback.xml | 8 +- 11 files changed, 424 insertions(+), 204 deletions(-) create mode 100644 src/main/resources/logback-spring.xml delete mode 100644 src/main/resources/logback.xml (limited to 'src') diff --git a/src/main/java/org/onap/clamp/clds/config/DefaultUserConfiguration.java b/src/main/java/org/onap/clamp/clds/config/DefaultUserConfiguration.java index 1261a5e95..d20a7370c 100644 --- a/src/main/java/org/onap/clamp/clds/config/DefaultUserConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/DefaultUserConfiguration.java @@ -53,7 +53,7 @@ import org.springframework.security.crypto.password.PasswordEncoder; public class DefaultUserConfiguration extends WebSecurityConfigurerAdapter { protected static final EELFLogger logger = EELFManager.getInstance().getLogger(DefaultUserConfiguration.class); - protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); + private static final String SETUP_WEB_USERS_EXCEPTION_MSG = "Exception occurred during the " + " setup of the Web users in memory"; @Autowired diff --git a/src/main/java/org/onap/clamp/loop/components/external/DcaeComponent.java b/src/main/java/org/onap/clamp/loop/components/external/DcaeComponent.java index 3e8cfaf9b..8b8547195 100644 --- a/src/main/java/org/onap/clamp/loop/components/external/DcaeComponent.java +++ b/src/main/java/org/onap/clamp/loop/components/external/DcaeComponent.java @@ -23,6 +23,8 @@ package org.onap.clamp.loop.components.external; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonObject; import java.util.Iterator; @@ -30,6 +32,7 @@ import java.util.LinkedList; import java.util.List; import java.util.UUID; +import javax.persistence.Transient; import org.apache.camel.Exchange; import org.json.simple.JSONArray; import org.json.simple.JSONObject; @@ -43,6 +46,9 @@ import org.onap.clamp.policy.microservice.MicroServicePolicy; public class DcaeComponent extends ExternalComponent { + @Transient + private static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeComponent.class); + private static final String DCAE_DEPLOYMENT_PREFIX = "CLAMP_"; private static final String DEPLOYMENT_PARAMETER = "dcaeDeployParameters"; private static final String DCAE_SERVICETYPE_ID = "serviceTypeId"; @@ -142,6 +148,7 @@ public class DcaeComponent extends ExternalComponent { if (deploymentProp != null) { rootObject.add(DCAE_INPUTS, deploymentProp); } + logger.info("DCAE Deploy payload for unique blueprint: " + rootObject.toString()); return rootObject.toString(); } @@ -164,6 +171,7 @@ public class DcaeComponent extends ExternalComponent { if (deploymentProp != null) { rootObject.add(DCAE_INPUTS, deploymentProp); } + logger.info("DCAE Deploy payload for multiple blueprints: " + rootObject.toString()); return rootObject.toString(); } @@ -176,6 +184,7 @@ public class DcaeComponent extends ExternalComponent { public static String getUndeployPayload(Loop loop) { JsonObject rootObject = new JsonObject(); rootObject.addProperty(DCAE_SERVICETYPE_ID, loop.getLoopTemplate().getDcaeBlueprintId()); + logger.info("DCAE Undeploy payload for unique blueprint: " + rootObject.toString()); return rootObject.toString(); } @@ -188,6 +197,7 @@ public class DcaeComponent extends ExternalComponent { public static String getUndeployPayload(MicroServicePolicy policy) { JsonObject rootObject = new JsonObject(); rootObject.addProperty(DCAE_SERVICETYPE_ID, policy.getDcaeBlueprintId()); + logger.info("DCAE Undeploy payload for multiple blueprints: " + rootObject.toString()); return rootObject.toString(); } diff --git a/src/main/java/org/onap/clamp/loop/components/external/PolicyComponent.java b/src/main/java/org/onap/clamp/loop/components/external/PolicyComponent.java index 2d7b807c0..f963e3514 100644 --- a/src/main/java/org/onap/clamp/loop/components/external/PolicyComponent.java +++ b/src/main/java/org/onap/clamp/loop/components/external/PolicyComponent.java @@ -81,13 +81,13 @@ public class PolicyComponent extends ExternalComponent { public static String createPoliciesPayloadPdpGroup(Loop loop) { HashMap>> pdpGroupMap = new HashMap<>(); for (OperationalPolicy opPolicy : loop.getOperationalPolicies()) { - pdpGroupMap = updatePdpGroupMap(opPolicy.getPdpGroup(), opPolicy.getPdpSubgroup(), + updatePdpGroupMap(opPolicy.getPdpGroup(), opPolicy.getPdpSubgroup(), opPolicy.getName(), opPolicy.getPolicyModel().getVersion(), pdpGroupMap); } for (MicroServicePolicy msPolicy : loop.getMicroServicePolicies()) { - pdpGroupMap = updatePdpGroupMap(msPolicy.getPdpGroup(), msPolicy.getPdpSubgroup(), + updatePdpGroupMap(msPolicy.getPdpGroup(), msPolicy.getPdpSubgroup(), msPolicy.getName(), msPolicy.getPolicyModel().getVersion(), pdpGroupMap); } @@ -98,13 +98,12 @@ public class PolicyComponent extends ExternalComponent { return payload; } - private static HashMap>> updatePdpGroupMap(String pdpGroup, - String pdpSubGroup, - String policyName, - String policyModelVersion, - HashMap>> pdpGroupMap) { - + private static void updatePdpGroupMap(String pdpGroup, + String pdpSubGroup, + String policyName, + String policyModelVersion, + HashMap>> pdpGroupMap) { JsonObject policyJson = new JsonObject(); policyJson.addProperty("name", policyName); policyJson.addProperty("version", policyModelVersion); @@ -126,8 +125,6 @@ public class PolicyComponent extends ExternalComponent { policyList.add(policyJson); pdpSubGroupMap.put(pdpSubGroup, policyList); pdpGroupMap.put(pdpGroup, pdpSubGroupMap); - - return pdpGroupMap; } private static JsonObject generateActivatePdpGroupPayload( @@ -170,9 +167,7 @@ public class PolicyComponent extends ExternalComponent { List policyNamesList = new ArrayList<>(); for (OperationalPolicy opPolicy : loop.getOperationalPolicies()) { policyNamesList.add(opPolicy.getName()); - for (String guardName : opPolicy.createGuardPolicyPayloads().keySet()) { - policyNamesList.add(guardName); - } + policyNamesList.addAll(opPolicy.createGuardPolicyPayloads().keySet()); } for (MicroServicePolicy microServicePolicy : loop.getMicroServicePolicies()) { policyNamesList.add(microServicePolicy.getName()); diff --git a/src/main/resources/META-INF/resources/swagger.html b/src/main/resources/META-INF/resources/swagger.html index 3f3ec6eb1..1f8cc9ebe 100644 --- a/src/main/resources/META-INF/resources/swagger.html +++ b/src/main/resources/META-INF/resources/swagger.html @@ -737,13 +737,13 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b

1.1. Version information

-

Version : 5.0.0-SNAPSHOT

+

Version : 5.0.2-SNAPSHOT

1.2. URI scheme

-

Host : localhost:46561
+

Host : localhost:34889
BasePath : /restservices/clds/
Schemes : HTTP

@@ -4344,7 +4344,7 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
diff --git a/src/main/resources/application-noaaf.properties b/src/main/resources/application-noaaf.properties index 4701b36df..d61b7ed53 100644 --- a/src/main/resources/application-noaaf.properties +++ b/src/main/resources/application-noaaf.properties @@ -81,6 +81,7 @@ server.tomcat.max-idle-time=60000 #Servlet context parameters server.context_parameters.p-name=value #context parameter with p-name as key and value as value. +camel.springboot.tracing=true camel.springboot.consumer-template-cache-size=1000 camel.springboot.producer-template-cache-size=1000 camel.springboot.jmx-enabled=true diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 5bf7910a2..3937d8fc2 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -85,7 +85,7 @@ server.tomcat.max-idle-time=60000 #Servlet context parameters server.context_parameters.p-name=value #context parameter with p-name as key and value as value. - +camel.springboot.tracing=true camel.springboot.consumer-template-cache-size=1000 camel.springboot.producer-template-cache-size=1000 camel.springboot.jmx-enabled=true diff --git a/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/src/main/resources/clds/camel/rest/clamp-api-v2.xml index d81c164a5..e6741d6f8 100644 --- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml +++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml @@ -16,10 +16,19 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + + + + 500 + + + GET All Loop names FAILED + @@ -40,10 +49,19 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + + + + 500 + + + GET Loop FAILED + @@ -64,10 +82,19 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + + + + 500 + + + GET SVG For loop FAILED + @@ -96,10 +123,19 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + + + + 500 + + + UPDATE Global properties FAILED + @@ -127,10 +163,21 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + + + + + 500 + + + UPDATE Operational policies FAILED + @@ -161,10 +208,20 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + + + + 500 + + + UPDATE MicroService policy FAILED + @@ -195,14 +252,20 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + message="DEPLOY request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" /> + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DEPLOY request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> + + 500 + + + DEPLOY request FAILED + @@ -230,14 +293,20 @@ java.lang.Exception - false + true + message="REFRESH json schema request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" /> + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('REFRESH Json schema request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> + + 500 + + + REFRESH json schema request FAILED + @@ -265,14 +334,20 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + message="REFRESH json schema request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" /> + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('REFRESH Json schema request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> + + 500 + + + REFRESH json schema request FAILED + @@ -302,14 +377,20 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + message="UNDEPLOY request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" /> + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('UNDEPLOY request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> + + 500 + + + UNDEPLOY request FAILED + @@ -339,14 +420,20 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + message="STOP request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" /> + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('STOP request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> + + 500 + + + STOP request FAILED + @@ -377,14 +464,20 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + message="RESTART request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" /> + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('RESTART request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> + + 500 + + + RESTART request FAILED + @@ -479,14 +572,20 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + message="SUBMIT request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" /> + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('SUBMIT request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> + + 500 + + + SUBMIT request FAILED + @@ -552,14 +651,20 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + message="DELETE request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" /> + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DELETE request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> + + 500 + + + DELETE request FAILED + @@ -584,21 +689,27 @@ + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('GET STATUS request successfully executed','INFO',${exchangeProperty[loopObject]})" /> java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + message="GET STATUS request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" /> + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('GET STATUS request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" /> + + 500 + + + GET STATUS request FAILED + @@ -627,14 +738,20 @@ java.lang.Exception - false + true + message="ADD operational policy request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" /> + + 500 + + + ADD Operational policy request FAILED + @@ -657,14 +774,20 @@ java.lang.Exception - false + true + message="REMOVE operational policy request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" /> + + 500 + + + REMOVE Operational policy request FAILED + @@ -691,14 +814,18 @@ true + + + 500 - - ERROR: ${exception.message} - - + + CREATE Loop from template FAILED + @@ -719,10 +846,18 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + + + 500 + + + GET Dictionary FAILED + @@ -744,10 +879,18 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + + + 500 + + + GET Dictionary FAILED + @@ -769,10 +912,18 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + + + 500 + + + GET Dictionary FAILED + @@ -796,10 +947,18 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + + + 500 + + + PUT Dictionary FAILED + @@ -826,10 +985,18 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + + + 500 + + + PUT Dictionary FAILED + @@ -850,10 +1017,18 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + + + 500 + + + DELETE Dictionary FAILED + @@ -876,10 +1051,18 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + + + 500 + + + DELETE Dictionary element FAILED + @@ -904,14 +1087,16 @@ true + + 500 - - ERROR: ${exception.message} - - + + GET Policy models FAILED + @@ -936,14 +1121,16 @@ true + + 500 - - ERROR: ${exception.message} - - + + GET Policy model FAILED + @@ -967,14 +1154,16 @@ true + + 500 - - ERROR: ${exception.message} - - + + GET Policy model YAML FAILED + @@ -1003,14 +1192,16 @@ true + + - 404 + 500 - - ERROR: ${exception.message} - - + + POST Policy model YAML FAILED + @@ -1039,14 +1230,16 @@ true - - 404 - - - ERROR: ${exception.message} - + + + 500 + + + MODIFY Policy model YAML FAILED + @@ -1071,14 +1264,16 @@ true + + 500 - - ERROR: ${exception.message} - - + + GET ALL templates FAILED + @@ -1103,14 +1298,16 @@ true + + 500 - - ERROR: ${exception.message} - - + + GET Template FAILED + @@ -1131,10 +1328,18 @@ java.lang.Exception - false + true + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" /> + + + 500 + + + GET All Template names FAILED + @@ -1155,10 +1360,18 @@ java.lang.Exception - false + true + + + 500 + + + GET SVG for Template FAILED + diff --git a/src/main/resources/logback-default.xml b/src/main/resources/logback-default.xml index 4c496716c..a91f9576b 100644 --- a/src/main/resources/logback-default.xml +++ b/src/main/resources/logback-default.xml @@ -58,16 +58,12 @@ - ${outputDirectory}/clamp/error.%d{yyyy-MM-dd}.%i.log.zip + ${logDirectory}/error.%d{yyyy-MM-dd}.%i.log.zip 50MB - 30 - 10GB + 20 + 1GB - - 10MB - - ${outputDirectory}/clamp/debug.%d{yyyy-MM-dd}.%i.log.zip + ${logDirectory}/debug.%d{yyyy-MM-dd}.%i.log.zip 50MB - 30 - 10GB + 20 + 1GB @@ -100,15 +96,13 @@ - 10 - ${logDirectory}/audit.%i.log.zip + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + ${logDirectory}/audit.%d{yyyy-MM-dd}.%i.log.zip + 50MB + 20 + 1GB - - 10MB - - 10 - ${logDirectory}/metric.%i.log.zip + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + ${logDirectory}/metric.%d{yyyy-MM-dd}.%i.log.zip + 50MB + 20 + 1GB - - 10MB - + @@ -155,16 +148,15 @@ - 10 - ${logDirectory}/security.%i.log.zip + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + ${logDirectory}/security.%d{yyyy-MM-dd}.%i.log.zip + 50MB + 20 + 1GB - - 10MB - + @@ -177,39 +169,34 @@ class="ch.qos.logback.core.rolling.RollingFileAppender"> - ${logDirectory}/Audit-${lrmRVer}-${lrmRO}-${Pid}.log + ${logDirectory}/Audits.log - ${logDirectory}/Audit-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + ${logDirectory}/Audits-%d{yyyy-MM-dd}.%i.log.zip - 1 - 9 + 50MB + 20 + 1GB - - 5MB - "%d [%thread] %-5level %logger{1024} - %msg%n" + - ${logDirectory}/Perform-${lrmRVer}-${lrmRO}-${Pid}.log + ${logDirectory}/Perform.log - ${logDirectory}/Perform-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip + class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + ${logDirectory}/Perform--%d{yyyy-MM-dd}.%i.log.zip - 1 - 9 + 50MB + 20 + 1GB - - 5MB - "%d [%thread] %-5level %logger{1024} - %msg%n" @@ -220,19 +207,30 @@ level="DEBUG"> + + + + + + + + level="INFO"> + level="INFO"> - + @@ -240,7 +238,6 @@ - diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 000000000..ffa497f1d --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml deleted file mode 100644 index ffa497f1d..000000000 --- a/src/main/resources/logback.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml index c71bcba8f..c47cab31c 100644 --- a/src/test/resources/logback.xml +++ b/src/test/resources/logback.xml @@ -78,10 +78,14 @@ + level="INFO" > + + + level="INFO" > + + -- cgit 1.2.3-korg