String invocationId = headers.get(ONAPLogConstants.Headers.INVOCATION_ID);
if (invocationId == null || invocationId.isEmpty())
invocationId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
- }
-
- public void setInvocationIdFromMDC() {
- String invocationId = MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID);
- if (invocationId == null || invocationId.isEmpty())
- invocationId = UUID.randomUUID().toString();
+ MDC.put(ONAPLogConstants.MDCs.SERVER_INVOCATION_ID, invocationId);
MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
}
}
public void clearClientMDCs() {
- MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID);
+ MDC.remove(ONAPLogConstants.MDCs.CLIENT_INVOCATION_ID);
MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE);
MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE);
}
public String getProperty(String property) {
- logger.info("Checking for system property [{}]", property);
String propertyValue = System.getProperty(property);
if (propertyValue == null || propertyValue.isEmpty()) {
- logger.info("System property was null or empty. Checking environment variable for: {}", property);
propertyValue = System.getenv(property);
if (propertyValue == null || propertyValue.isEmpty()) {
- logger.info("Environment variable: {} was null or empty. Returning value: {}", property,
- Constants.DefaultValues.UNKNOWN);
propertyValue = Constants.DefaultValues.UNKNOWN;
}
}
protected String getBasicAuthUserName(SimpleMap headers) {
String encodedAuthorizationValue = headers.get(HttpHeaders.AUTHORIZATION);
- if (encodedAuthorizationValue != null) {
+ if (encodedAuthorizationValue != null && encodedAuthorizationValue.startsWith("Basic")) {
try {
// This will strip the word Basic and single space
encodedAuthorizationValue = encodedAuthorizationValue.substring(6);