summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
5dea222)
Clear the MDC variables at the beginning and the end of the API calls.
Issue-ID: CLAMP-271
Change-Id: I32504b00c812a4441ba1e4548bb7f42cf2894993
Signed-off-by: xg353y <xg353y@intl.att.com>
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.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;
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();
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;
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) {
// 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 {
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 new ResponseEntity<>(cldsHealthCheck, HttpStatus.OK);
}
}
* @return this.\r
*/\r
public void entering(HttpServletRequest request, String serviceName) {\r
* @return this.\r
*/\r
public void entering(HttpServletRequest request, String serviceName) {\r
checkNotNull(request);\r
// Extract MDC values from standard HTTP headers.\r
final String requestID = defaultToUUID(request.getHeader(ONAPLogConstants.Headers.REQUEST_ID));\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
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
}\r
\r
this.mLogger.info(ONAPLogConstants.Markers.ENTRY);\r