question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add Propagated Properties to MDC for logging

See original GitHub issue

Currently, 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
marcingrzejszczakcommented, Feb 20, 2018

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.

2reactions
codefromthecryptcommented, Jun 28, 2018

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 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java Logging with Mapped Diagnostic Context (MDC)
MDC stamps each request by putting the context information in the thread local context. Learn to use MDC with SLF4J, Logback and Log4j2....
Read more >
Improved Java Logging with Mapped Diagnostic Context (MDC)
In this tutorial, we will explore the use of Mapped Diagnostic Context (MDC) to improve the application logging. Mapped Diagnostic Context ...
Read more >
How to use Log4j and MDC in Java Spring Boot Application?
This article will help you build a Spring Boot Java application to log messages with Log4j and use the MDC of this library...
Read more >
MDC context logging properties not propagating inside ...
Hello. The MDC markers placed before a promise handler do not appear alongside the log statement in the handler.
Read more >
Propagating custom information in Log events - 8.0
Deprecated About this task The MDC feature of existing logging frameworks like log4j, slf4j, and so on, can be used to propagate custom...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found