[slf4j-dev] [JIRA] (SLF4J-480) When using `parallelStream()` function to do something, MDC does not work.

QOS.CH (JIRA) noreply-jira at qos.ch
Mon Dec 30 03:55:00 CET 2019


Liu Cong created SLF4J-480:
------------------------------

             Summary: When using `parallelStream()` function to do something, MDC does not work.
                 Key: SLF4J-480
                 URL: https://jira.qos.ch/browse/SLF4J-480
             Project: SLF4J
          Issue Type: Bug
            Reporter: Liu Cong
            Assignee: SLF4J developers list
            Priority: Critical


I need to log a few attributes of the request like the request id and the locale, but when using parallelStream, it seems that the ThreadLocal of the MDC looses the information.

Ive analyzed the solution of passing the MDC context between the threads when creating the parallelStream but it seems dirty and I also have a lot of usages of the parallelStream.

Is there any other way of doing this?

Thank you



--
This message was sent by Atlassian JIRA
(v7.3.1#73012)


More information about the slf4j-dev mailing list