Questions tagged [mdc]

MDC (*mapped diagnostic context*) is a way to attach thread-scoped named identifier that can be added to every log message from that thread.

It is used to provide log messages with information that is unavailable to the scope when log is written.It provides the thread and user context to log messages and hence stamp each log for better tracking.

For example, it can help put Correlation Id to a request’s logs to help filter it out from similar logs at that time (from other quests) and also track it easily when this request hop from service to service by sharing the Correlation Id.

Typical use cases

Useful links

288 questions
0
votes
1 answer

Open Telemetry Logger MDC auto-instrumentation

The following Open Telemetry starters have been added to the Spring Boot project (v2.7.2) to instrument the application: io.opentelemetry.instrumentation
Toni
  • 3,296
  • 2
  • 13
  • 34
0
votes
1 answer

background of my activity becomes transparent while closing the app

I've created a calculator app, and it works fine, but there's one question - why the background becomes transparent when i close the app by performing home gesture? Here's how it looks: how to repair this? Thanks, any help appreciated. Here's the…
macizett
  • 23
  • 4
0
votes
0 answers

sass error on "@use '@material/feature-targeting/feature-targeting'" in "node_modues/@material/theme/_theme.scss";

I have never actively used sass, but Google's Material Design is written so that I need sass. But I stumbled upon this error and can't find out what is wrong. Error: Can't find stylesheet to import. ╷ 26 │ @use…
Leo
  • 4,136
  • 6
  • 48
  • 72
0
votes
1 answer

How to share MDC context between threads in multimodule project in kotlin - kotlinx.coroutines.slf4j

I have a multi-module project where I would like to have a context to be shared through the different modules. In my core module (from which all of them depends on), I have created a class to manage the context using org.slf4j.MDC with two…
Lorena
  • 93
  • 6
0
votes
1 answer

Is it possible to filter key-value pairs of a ThreadContextMap with a Regex?

I wish to filter certain logs if the "env" key in the ThreadContextMap has a value of prod1 or qa1. I already have something like the following set up:
waffledood
  • 193
  • 8
0
votes
0 answers

logback with MDC: Using multiple custom blocks instead of one mdc block for custom key values

I'm using Java and logback in my application, as well as MDC to log custom key-values. i way, to have my logged key-values pairs to be unders two blocks, instead of having them all unders MDC block ? Example: { "timestamp" : "2022-12-19…
AmineM
  • 93
  • 1
  • 8
0
votes
2 answers

MDC value missing from log

My app is running on amazon SWF and I want to be able to see all the logs of a specific request using an slf4j MDC. For some code flows I see the MDC in the logs, but for some they are missing, for example: I have these 2 lines of code one after the…
T.G.
  • 743
  • 3
  • 6
  • 27
0
votes
0 answers

How to Log an ObjectID / a dynamic value in MDC for logback in spring boot app using reactor

I am struggeling to log an object's property (for example its id) received by Flux/Mono by using the MDC in an reactive environment. I know how to put data from the reactors context to MDC. Unfortunatly I am unable to put a custom dynamically data…
Steven
  • 61
  • 1
  • 3
  • 10
0
votes
0 answers

Quarkus MDC not propagated to Mutiny thread logs

I need to get a single MDC value to appear also in logs from mutiny. It seems like MDC from caller thread is not automatically propagated to thread created by mutiny. Actually thought that this would be done by quarkus-smallrye-context-propagation…
syr
  • 836
  • 1
  • 12
  • 28
0
votes
0 answers

How to copy MDC values between Threads using SpringBoot version 1.3.8.RELEASE?

I need MDC Context to pass from one thread to another, I need it because when using @ASync it gets lost. In the projects I have Spring version 1.3.8.RELEASE is used, this guy already comes with version 1.1.7 of LOGBack, in version 1.1.5 logback…
0
votes
0 answers

SpringBoot - MDC filter for sl4j

Spring Boot - MDC filter for logging props like correlation-id, http-method with slf4j logs is not working for the been I have created manually whereas it prints the correlation id, http-method in the log that comes out of the class with spring…
jdkar
  • 21
  • 2
0
votes
0 answers

How to stop spring sleuth from adding data to MDC

Currently needed data such as spanId and traceId already logs, but sleuth also ads a lot of useless data do the MDC and since I'am using MDC quite heavily I really don't need al this excess data to be in the logs, is there a way to stop Sleuth from…
0
votes
1 answer

Quarkus - MDC - Azure Application Insights

I'm having trouble with configuring MDC for Quarkus and to expose the additional information to Azure Application Insight. When I run the application locally, than the information is shown correctly in my console. Quarkus version:…
user965220
  • 45
  • 1
  • 7
0
votes
0 answers

Clearing MDC when HTTP response is sent by Jersey

I'm building a Java back-end using Spring with Jersey, where I want to send a multipart response to the client. I have a GET call that looks something like this: @Path("/status/{requestID}") @GET public Response getStatus(@PathParam("requestID")…
user007
  • 2,156
  • 2
  • 20
  • 35
0
votes
1 answer

How to pass request-id in quarkus through activeMQ?

My application is generating a request and then sending that request to a listener(activemq here) for further processing, I am trying to add a request-id to the logs for better tracing of errors but the request-id is not passing to the listener it…
ss13199
  • 1
  • 4