diff options
author | 2020-12-16 15:17:33 +0000 | |
---|---|---|
committer | 2020-12-17 12:37:03 +0000 | |
commit | b9f857d3bf6d7fa8f9d0d5fa1796113d43e6e50d (patch) | |
tree | 316214c380f1e5c1ac53cb3f6ea7040e7bd6ea19 /cps-rest/src/main/java/org | |
parent | 84ac94d2f3f9ebd6a3a7befa244beef851eac126 (diff) |
Adding logging example
Logging example as part of CPS-10
Issue-ID: CPS-10
Signed-off-by: niamhcore <niamh.core@est.tech>
Change-Id: I6428b01d112f27f9e4c9c72ac02236fcc49a6a1c
Diffstat (limited to 'cps-rest/src/main/java/org')
-rw-r--r-- | cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java b/cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java index 9d7f38ae8..d1a773c1e 100644 --- a/cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java @@ -19,6 +19,7 @@ package org.onap.cps.rest.exceptions; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.exception.ExceptionUtils; import org.onap.cps.rest.controller.AdminRestController; import org.onap.cps.rest.controller.DataRestController; @@ -35,6 +36,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; +@Slf4j @RestControllerAdvice(assignableTypes = {AdminRestController.class, DataRestController.class}) public class CpsRestExceptionHandler { @@ -74,6 +76,7 @@ public class CpsRestExceptionHandler { private static ResponseEntity<Object> buildErrorResponse(final HttpStatus status, final String message, final String details) { + log.error("An error has occurred : {} Status: {} Details: {}", message, status, details); final ErrorMessage errorMessage = new ErrorMessage(); errorMessage.setStatus(status.toString()); errorMessage.setMessage(message); |