How to use MDC key value in logs ? #40479
Unanswered
angelfrend
asked this question in
Q&A
Replies: 2 comments 2 replies
-
Try with: %X{} in your log format. |
Beta Was this translation helpful? Give feedback.
1 reply
-
At present I don't think the built-in JSON formatter supports MDC keys in the log. However there is a Quarkiverse JSON extension which does support MDC configuration. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am setting an MDC value in my code. I do not know how to map this MDC value into my logs.
Example RestEndpoint
Logging configuration
Dependency used:
Output now
{"timestamp":"2024-05-06 21:47:44","message":"Sample log from Get Method","mdc":{"correlation_id":"03842e41-6e97-4bbc-bf23-9088872acb74"}}
Expected Output
{"timestamp":"2024-05-06 21:47:44","message":"Sample log from Get Method","correlation_id":"03842e41-6e97-4bbc-bf23-9088872acb74"}
Can someone help on how to map mdc value for correlation id, into a separate field like here in expected output ?
Sample project can be cloned here https://github.com/angelfrend/quarkus-logging-demo.git
Beta Was this translation helpful? Give feedback.
All reactions