diff options
author | elinuxhenrik <henrik.b.andersson@est.tech> | 2020-11-17 17:05:07 +0100 |
---|---|---|
committer | elinuxhenrik <henrik.b.andersson@est.tech> | 2020-11-18 10:00:03 +0100 |
commit | a7af96db46c35c091b4a6c082fb36bd7ece86a40 (patch) | |
tree | a237c647185e98772e8e00d79787ec12a7276f4a /a1-policy-management/src/main | |
parent | fa658f6a48672cc005ad2877a59d1794a8963b1b (diff) |
Add logging to ConfigurationController
Change-Id: If05cec191896c6290086b8c3c1464f589a95e104
Issue-ID: CCSDK-2966
Signed-off-by: elinuxhenrik <henrik.b.andersson@est.tech>
Diffstat (limited to 'a1-policy-management/src/main')
-rw-r--r-- | a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java index 5497e0a5..7a432f83 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java @@ -34,6 +34,8 @@ import org.onap.ccsdk.oran.a1policymanagementservice.configuration.Configuration import org.onap.ccsdk.oran.a1policymanagementservice.controllers.VoidResponse; import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.ErrorResponse.ErrorInfo; import org.onap.ccsdk.oran.a1policymanagementservice.exceptions.ServiceException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -45,6 +47,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController("ConfigurationControllerV2") @Api(tags = {Consts.V2_CONFIG_API_NAME}) public class ConfigurationController { + private static final Logger logger = LoggerFactory.getLogger(ConfigurationController.class); @Autowired ConfigurationFile configurationFile; @@ -63,10 +66,12 @@ public class ConfigurationController { ApplicationConfigParser configParser = new ApplicationConfigParser(); configParser.parse(configJson); configurationFile.writeFile(configJson); + logger.info("Configuration changed through REST call."); } catch (ServiceException | JsonSyntaxException e) { return ErrorResponse.create(String.format("Faulty configuration. %s", e.getMessage()), HttpStatus.BAD_REQUEST); } catch (IOException ioe) { + logger.warn("Configuration file not written, {}.", ioe.getMessage()); ErrorResponse.create("Internal error when writing the configuration. Try again.", HttpStatus.INTERNAL_SERVER_ERROR); } |