[slf4j-dev] Contributing MDC-aware Executors to slf4j

Ceki ceki at qos.ch
Fri Apr 17 18:36:13 CEST 2020


Hi Robert,

Sure. Alternatively, It think it might be better if you could start an 
independent project with a single maven module and we'll go from there.

Best regards,

--
Ceki Gülcü


On 17.04.2020 18:26, Robert Munteanu wrote:
> Hi Ceki,
> 
> I think it's simpler if I just start with the code and some tests.
> Would it work for you if I put the code on GitHub and then submit a PR
> if you find it useful?
> 
> Thanks,
> Robert
> 
> On Sat, 2020-04-11 at 13:16 +0200, Ceki wrote:
>> Hi Robert,
>>
>> Thank you for your post.
>>
>> My feeling is that while the calls MDC are usually simple, said
>> invocations need to be correctly embedded within the environment of
>> the
>> asynchronous programming model in use. I have also observed that
>> there
>> is a strong tendency by developers to forget to clear the MDC. There
>> is
>> also a tendency to sprinkle the code with MDC.clear() all over the
>> place
>> which is almost just as bad.
>>
>>
>> Anyway, I'd happy to collaborate.
>>
>> --
>> Ceki Gülcü
>>
>> On 09.04.2020 14:01, Robert Munteanu wrote:
>>> Hi,
>>>
>>> When working with asynchronous programming models ( Netty,
>>> CompletableFuture, OSGi Promises ) it becomes problematic to
>>> propagate
>>> the MDC between the worker threads.
>>>
>>> I see such questions asked and solutions that work more or less
>>> posted,
>>> e.g. [1], [2], [3].
>>>
>>> I think it would be worthwhile to provide basic utilities in the
>>> slf4j
>>> project, otherwise everyone keeps reinventing the wheel.
>>>
>>> I have a couple of classes ( Executor, ScheduledExecutorService )
>>> that
>>> work well with my setup (Netty, OSGi Promises ) and would be
>>> willing to
>>> contribute them to slf4j.
>>>
>>> Is there interest in accepting such a contribution?
>>>
>>> Thanks,
>>> Robert
>>>
>>> [1]:
>>> https://stackoverflow.com/questions/28668560/using-org-slf4j-mdc-with-netty-channels
>>> [2]:
>>> https://stackoverflow.com/questions/49110745/how-to-retain-slf4j-mdc-logging-context-in-completablefuture
>>> [3]:
>>> https://medium.com/asyncparadigm/logging-in-a-multithreaded-environment-and-with-completablefuture-construct-using-mdc-1c34c691cef0
>>>
>> _______________________________________________
>> slf4j-dev mailing list
>> slf4j-dev at qos.ch
>> http://mailman.qos.ch/mailman/listinfo/slf4j-dev
> 
> _______________________________________________
> slf4j-dev mailing list
> slf4j-dev at qos.ch
> http://mailman.qos.ch/mailman/listinfo/slf4j-dev
> 

-- 
--
Ceki Gülcü


More information about the slf4j-dev mailing list