import org.onap.clamp.clds.dao.CldsDao;
import org.onap.clamp.clds.model.CldsHealthCheck;
import org.onap.clamp.clds.util.LoggingUtils;
+import org.onap.clamp.clds.util.ONAPLogConstants;
+import org.slf4j.event.Level;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
public ResponseEntity<CldsHealthCheck> gethealthcheck() {
CldsHealthCheck cldsHealthCheck = new CldsHealthCheck();
Date startTime = new Date();
+ LoggingUtils util = new LoggingUtils(logger);
LoggingUtils.setRequestContext("CldsService: GET healthcheck", "Clamp-Health-Check");
LoggingUtils.setTimeContext(startTime, new Date());
boolean healthcheckFailed = false;
// audit log
LoggingUtils.setTimeContext(startTime, new Date());
if(healthcheckFailed) {
+ util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "Healthcheck failed", Level.INFO, ONAPLogConstants.ResponseStatus.ERROR);
return new ResponseEntity<>(cldsHealthCheck, HttpStatus.INTERNAL_SERVER_ERROR);
} else {
+ util.exiting("200", "Healthcheck failed", Level.INFO, ONAPLogConstants.ResponseStatus.COMPLETED);
return new ResponseEntity<>(cldsHealthCheck, HttpStatus.OK);
}
}
* @return this.\r
*/\r
public void entering(HttpServletRequest request, String serviceName) {\r
+ MDC.clear();\r
checkNotNull(request);\r
// Extract MDC values from standard HTTP headers.\r
final String requestID = defaultToUUID(request.getHeader(ONAPLogConstants.Headers.REQUEST_ID));\r
if (serviceName == null ||\r
serviceName.equalsIgnoreCase(EMPTY_MESSAGE)) {\r
MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI());\r
+ } else {\r
+ MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, serviceName);\r
}\r
\r
this.mLogger.info(ONAPLogConstants.Markers.ENTRY);\r