diff --git a/src/main/java/org/eclipse/xpanse/terraform/boot/logging/CustomRequestIdGenerator.java b/src/main/java/org/eclipse/xpanse/terraform/boot/logging/CustomRequestIdGenerator.java index 01e0a6f..213ddc7 100644 --- a/src/main/java/org/eclipse/xpanse/terraform/boot/logging/CustomRequestIdGenerator.java +++ b/src/main/java/org/eclipse/xpanse/terraform/boot/logging/CustomRequestIdGenerator.java @@ -16,12 +16,20 @@ */ public class CustomRequestIdGenerator implements CorrelationId { + /** + * The key of the request id in MDC. + */ public static final String REQUEST_ID = "REQUEST_ID"; + /** + * The key of the tracking id in MDC. + */ + private static final String TRACKING_ID = "TRACKING_ID"; + @Override public String generate(@NonNull HttpRequest request) { String uuid = UUID.randomUUID().toString(); - MDC.put(REQUEST_ID, uuid); + MDC.put(TRACKING_ID, uuid); return uuid; } } diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index f54a89f..d38a068 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -10,7 +10,7 @@ - %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} [%X{REQUEST_ID}]- %msg%n + %d{yyyyMMdd HH:mm:ss.SSS} [%t] %-5level %logger{36} [%X{TRACKING_ID}] [%X{REQUEST_ID}]- %msg%n