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
1
vote
1 answer

Prevent MDC-dialog from closing

Is it possible to stop the dialog from closing when using the accept/cancel listeners? I've now set a custom button in my dialog. Is there something build-in in the MDC-dialog component to handle this? Thanks in advance!
Haidy
  • 259
  • 6
  • 19
1
vote
1 answer

Tracing messages through logs in WSO2 ESB 4.8.1

I need to get a unique ID to trace messages through logs. I am using WSO2 ESB 4.8.1. I have found an article related to WSO2 ESB 5.0.0. http://nuwanzone.blogspot.it/2016/12/wso2-esb-tracing-messages-through-logs.html . It describes how setting a…
1
vote
1 answer

Add MDC in Nodejs with log4j without requiring external libraries

I am facing an issue in nodejs where I have to print the username in the logs in the Metadata. Each request is having its own username and nodejs being async its overriding the username property that i have created for the singleton log. I have…
1
vote
1 answer

Propagate MDC using slf4j

I am using slf4j in my akka based application and using its MDC feature to log contextual information. I have one base actor who sends and receives messages from a set of actors who in turn communicate and with one other actor and so forth. How do I…
Rakesh Sharma
  • 301
  • 1
  • 3
  • 11
1
vote
1 answer

How to get MDC logging working for Spring Batch

In Spring Batch it would be great to keep track of the execution thread through logging. However, MDC does not seem to work. MDC.put("process", "batchJob"); logger.info("{}; status={}", getJobName(), batchStatus.name()); Anyone got MDC working in…
nsdiv
  • 912
  • 12
  • 30
1
vote
1 answer

MDC is not working Properly with Log4j

Hi I want to display the logged in User ID, Hostname, ip Address etc in the log pattern. I am using log4j for the same. I am using MDC. In My main Controller I am able to see the log with the specied Pattern but in Other file log I am not able the…
Asif Billa
  • 821
  • 2
  • 15
  • 28
1
vote
1 answer

Cassandra source -> sink replication

Is is possible to organize one way replication between data centers (DC). Let's say we have two DCs: A and B. I want all data written to nodes in DC A to be copied to DC B, but none of data written in DC B should go to A. Is it possible with…
1
vote
1 answer

Does akka copy MDC from source actor to other actors and futures?

As I read in akka specification it supports mdc in actors. E.g. I can put unic infomation in mdc and then use it in actor. But what about futures? Does akka provide any guaranties that a future which is initiated in actor will have the same mdc?…
Cherry
  • 31,309
  • 66
  • 224
  • 364
1
vote
1 answer

Retaining MDC with Spring AMQP Request/Reply

I have two services, A and B, communicating via Spring Remoting with AMQP. A exposes a REST API and populates the MDC (Mapped Diagnostic Context) with a UUID.randomUUID() (from within a Filter) on every request (and clears it when processing is…
Roy Stark
  • 463
  • 2
  • 15
1
vote
1 answer

Additional info from MDC to logs (java.util.logging)

Exist any possibility to add MDC to java.util.logging ? If yes, how to reach it ?
1
vote
2 answers

log4j 1.2.17 + MDC + UDP

I have an application which uses log4j 1.2.17 with MDC. I manage to configure remote logging using org.apache.log4j.net.SocketAppender, which uses TCP protocol:
Aram Aslanyan
  • 745
  • 3
  • 11
  • 18
1
vote
1 answer

Logback MDC print variables at runtime

I was wondering if it is possible to print a previously added MDC value from a logger call? example: MDC.put("user","tom") log.info("Hello %X{user}"); instead of adding it to the layout pattern. The reason for this is that I call MDC elsewhere…
tbo
  • 9,398
  • 8
  • 40
  • 51
1
vote
1 answer

MDC logging wrong session ID in log files

We are using MDC to log all transactions with session Id , but sometimes it appends the wrong sessiond Iam sessting the sessionId in Filter MDC.put("sessionId", request.getSession().getId()); Log Output 2015-01-24 23:13:04,857 INFO [STDOUT]…
NullPointerException
  • 3,732
  • 5
  • 28
  • 62
1
vote
1 answer

Console output in parallel tests shown in different test tree, than was launched in

I'm using TestNG 6.8.8 in Intellij IDEA 13.4, logback 1.1.2. I have bunch of test classes, and have xml launcher like this:
Nodonutsforyou
  • 408
  • 3
  • 9
1
vote
1 answer

MDC to differentiate logging between modules

My software uses a Service Oriented Architecture (SOA). All the services (lets call them modules for simplicity) writes to a single log file. I would like to distinguish logging between modules. Below is how I would like my log message to look like.…
TheMonkWhoSoldHisCode
  • 2,182
  • 3
  • 26
  • 40