Baggage value not getting printed in log4j2 logs

Viewed 118

Iam using log4j2 and sleuth 3.0.3

Below is the confiugration I have used to add a baggage to sleuth

spring.sleuth.baggage.remote-fields=sessionId
spring.sleuth.baggage.correlation-fields=sessionId

I set the baggage field value from the controller of a request shown below.

BaggageField.getByName("sessionId").updateValue("value");

I am able to access the value from other points using BaggageField.getByName("sessionId").getValue() and is being propagated to other services but it is not being acessible in the current service where added the baggage.

the log pattern is

 <PatternLayout pattern="%d{HH:mm:ss.SSS} [%tid] [%t] [%X{sessionId},%X{traceId},%X{spanId}] %-5level %logger{36} - %msg%n"/>

Every time I try to print it only traceid and spanid is getting printed leaving session id empty as shown below.

[,e5bf8cd9dbf910dc,cb689f3c036b4260]

What could be the issue here

0 Answers
Related