-
I couldn't find any reference to MDC in the docs of the HTTP client, and I cannot see the MDC of my threads being logged. So I wonder if I need to configure it somehow or if it's not supported yet. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Yes, it does. Have a look at MDC values are resolved with Log4j2 lookups (actually StrSubstitutor under the hood).
If you'd like to resolve MDC values, try this: <JacksonJsonLayout>
<VirtualProperty name="myMdcField" value="$${ctx:propertyName:-undefined}"/>
</JacksonJsonLayout> |
Beta Was this translation helpful? Give feedback.
Yes, it does. Have a look at
JacksonJsonLayout
documentation.MDC values are resolved with Log4j2 lookups (actually StrSubstitutor under the hood).
VirtualProperty
- optional and configurable withinJacksonJsonLayout
component - wraps StrSubstitutor and supports variable resolution just like Log4j2 KeyPair. It's quite limited though:${ctx:variableName}
can be used only with synchronous loggers${event:Marker}
are not supportedIf you'd like to resolve MDC values, try this: