Open ajaypilaniyawynk opened 5 months ago
I am using below message pattern : <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%level] [%thread] [%file:%line] [%X{traceId}] %msg%n
<pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%level] [%thread] [%file:%line] [%X{traceId}] %msg%n
Now suppose I have a code snipped like this -
MDC.put("traceId", "1234"); log.info("Started"); testMongoDao.findById("Test"); log.info("Stopped");
Then I get below logs :
[2024-03-28 16:14:06.522] [INFO] [runner-0] [TestClass.java:70] [1234] Started [2024-03-28 16:14:06.523] [INFO] [runner-0] [TestClass.java:72] [] Stopped
As you can see in second log line trace id is not printed. Is there any way to solve this? PS: I am using Spring Boot 3.2.3 with virtual threads. On normal threads there is no issue.
I am using below message pattern :
<pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%level] [%thread] [%file:%line] [%X{traceId}] %msg%n
Now suppose I have a code snipped like this -
Then I get below logs :
As you can see in second log line trace id is not printed. Is there any way to solve this? PS: I am using Spring Boot 3.2.3 with virtual threads. On normal threads there is no issue.