Add Propagated Properties to MDC for logging
See original GitHub issueCurrently, I would like to log the properties added to the configuration option spring.sleuth.propagation-keys in all my logs, like this:
Current
service1.log:2016-02-26 11:15:47.561 INFO [service1,2485ec27856c56f4,2485ec27856c56f4,true]
After Change
service1.log:2016-02-26 11:15:47.561 INFO [service1,2485ec27856c56f4,2485ec27856c56f4,true, MyPropagatedProperty]
From my initial investigation, I’ve found that this would require a change to Slf4jCurrentTraceContext to include custom propagated properties in the MDC, but this class is currently final, and also a change to the auto-config class TraceEnvironmentPostProcessor to include the properties in the log pattern.
I think this can also be a configuration field of whether to log the propagated properties or not. Probably spring.sleuth.log-propagation-keys which can be either true or false.
I am not sure if there is a better way to do this or not right now.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:17 (6 by maintainers)

Top Related StackOverflow Question
OTOH it’s a maintainability cost for us to open classes for an extension. You are the first one to request this, if there are more people asking for the same requirement then we might consider opening the class. Until then you’ll have to make a copy and alter it to your needs.
thanks for the replies… they aren’t unheard. just there’s no cycles quite yet
PS
I’m working on zipkin UI to work with v2 read endpoints which is needed to complete half-completed transition work before starting some new thing https://github.com/openzipkin/zipkin/issues/2047
Kudos and faster completion on this to those who help clear work in front of me 😄