diff options
Diffstat (limited to 'rulemgt/src/main')
3 files changed, 6 insertions, 9 deletions
diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/dcae/ConfigFileScanningTask.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/dcae/ConfigFileScanningTask.java index d24d567..650ebbb 100644 --- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/dcae/ConfigFileScanningTask.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/dcae/ConfigFileScanningTask.java @@ -186,6 +186,7 @@ public class ConfigFileScanningTask implements Runnable { private boolean deployRule(String clName, String contents) { RuleCreateRequest ruleCreateRequest = getRuleCreateRequest(clName, contents); if (JerseyClient.newInstance().header("Accept", MediaType.APPLICATION_JSON) + .header("username", DEFAULT_CREATOR) .put(url, Entity.json(ruleCreateRequest)) == null) { LOGGER.error("Failed to deploy rule: {}.", clName); return false; @@ -200,7 +201,6 @@ public class ConfigFileScanningTask implements Runnable { ruleCreateRequest.setContent(contents); ruleCreateRequest.setDescription(""); ruleCreateRequest.setEnabled(1); - ruleCreateRequest.setCreator(DEFAULT_CREATOR); return ruleCreateRequest; } diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java index 133e859..2c9a462 100644 --- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/resources/RuleMgtResources.java @@ -62,10 +62,9 @@ public class RuleMgtResources { try {
ruleChangeResponse = ruleMgtWrapper
.addCorrelationRule(UserUtil.getUserName(request), ruleCreateRequest);
- log.info("create rule:" + ruleCreateRequest.getRuleName() + " success.");
return ruleChangeResponse;
} catch (CorrelationException e) {
- log.error("create rule:" + ruleCreateRequest.getRuleName() + " failed", e);
+ log.error(String.format("failed to create the rule: %s", ruleCreateRequest.getRuleName()), e);
throw ExceptionUtil.buildExceptionResponse(e.getMessage());
}
}
@@ -85,7 +84,7 @@ public class RuleMgtResources { log.info("update rule:" + ruleUpdateRequest.getRuleId() + " successful");
return ruleChangeResponse;
} catch (CorrelationException e) {
- log.error("update rule:" + ruleUpdateRequest.getContent() + " failed", e);
+ log.error(String.format("failed to update the rule: %s", ruleUpdateRequest.getRuleId()), e);
throw ExceptionUtil.buildExceptionResponse(e.getMessage());
}
}
@@ -95,10 +94,9 @@ public class RuleMgtResources { public ResponseEntity deleteCorrelationRule(@PathVariable("ruleid") String ruleId) {
try {
ruleMgtWrapper.deleteCorrelationRule(new RuleDeleteRequest(ruleId));
- log.info("delete rule:" + ruleId + " successful");
return ResponseEntity.status(HttpStatus.NO_CONTENT).build();
} catch (CorrelationException e) {
- log.error("delete rule:" + ruleId + " failed", e);
+ log.error(String.format("failed to delete the rule: %s", ruleId), e);
throw ExceptionUtil.buildExceptionResponse(e.getMessage());
}
}
@@ -118,10 +116,9 @@ public class RuleMgtResources { try {
ruleQueryListResponse = ruleMgtWrapper
.getCorrelationRuleByCondition(ruleQueryCondition);
- log.info("query rule successful by condition:" + ruleQueryCondition);
return ruleQueryListResponse;
} catch (CorrelationException e) {
- log.error("query rule failed,cause query condition conversion failure", e);
+ log.error(String.format("failed to query the rule: %s", ruleQueryCondition.getName()), e);
throw ExceptionUtil.buildExceptionResponse(e.getMessage());
}
}
diff --git a/rulemgt/src/main/resources/logback-spring.xml b/rulemgt/src/main/resources/logback-spring.xml index 197057e..eda9c6b 100644 --- a/rulemgt/src/main/resources/logback-spring.xml +++ b/rulemgt/src/main/resources/logback-spring.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <configuration debug="false"> <property name="LOG_HOME" value="/var/log/ONAP/holmes"/> - <property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss SSS} %-5p [%c][%t] - %msg%n" /> + <property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss SSS} %-5p [%c][%t][%X{RequestID}][%X{InvocationID}] - %m%n" /> <appender name="Console" class="ch.qos.logback.core.ConsoleAppender"> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |