Tracking ID in log4j MDC

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Tracking ID in log4j MDC

Anil K
Hi All,

Is it possible to have a tracking id in MDC that will be shared across chained users defined operations like Filter, KeySelector, Flat map, Process function, and  Producer?

Tracking id will be read from headers of Kafka Message, which if possible plan to set to MDC in log4j. Right now I am seeing tracking id is not getting propagated to the next function.

I am using flink 1.9 running in k8.

Thanks, Anil
Reply | Threaded
Open this post in threaded view
|

Re: Tracking ID in log4j MDC

Till Rohrmann
Hi Anil,

Flink does not maintain the MDC context between threads. Hence, I don't think that it is possible w/o changes to Flink.

One note, if operators are chained then they are run by the same thread.

Cheers,
Till

On Wed, Dec 2, 2020 at 7:22 AM Anil K <[hidden email]> wrote:
Hi All,

Is it possible to have a tracking id in MDC that will be shared across chained users defined operations like Filter, KeySelector, Flat map, Process function, and  Producer?

Tracking id will be read from headers of Kafka Message, which if possible plan to set to MDC in log4j. Right now I am seeing tracking id is not getting propagated to the next function.

I am using flink 1.9 running in k8.

Thanks, Anil