[prev in list] [next in list] [prev in thread] [next in thread] 

List:       logback-dev
Subject:    [logback-dev] [JIRA] Assigned: (LBCLASSIC-264) MDC of parent thread
From:       "Ceki Gulcu (JIRA)" <noreply-jira () qos ! ch>
Date:       2011-05-06 9:44:51
Message-ID: 1260169901.1304675091427.JavaMail.ceki () pixie
[Download RAW message or body]


     [ http://jira.qos.ch/browse/LBCLASSIC-264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel \
]

Ceki Gulcu reassigned LBCLASSIC-264:
------------------------------------

    Assignee: Ceki Gulcu  (was: Logback dev list)

> MDC of parent thread can be wiped from child thread
> ---------------------------------------------------
> 
> Key: LBCLASSIC-264
> URL: http://jira.qos.ch/browse/LBCLASSIC-264
> Project: logback-classic
> Issue Type: Bug
> Affects Versions: 0.9.28
> Reporter: Iwein Fuld
> Assignee: Ceki Gulcu
> 
> In our web framework we're using the MDC, but because we use multiple rendering \
> threads we need to copy context from one thread to another. With log4j this worked \
> fine, with logback it doesn't. It seems that there is an issue at least with \
> setContextMap, which can influence the MDC in other (non child) threads. I've \
> reproduced one such issue in a small project:  \
> https://github.com/iwein/logback-testdrive Look at this testcase in particular:
> {code}
> @Test
> public void shouldCopyContextToOtherThread() throws Exception {
> final AtomicReference<Map> contextMap = new AtomicReference<Map>();
> MDC.put("first", "Dorothy");
> MDC.put("last", "Parker");
> contextMap.set(MDC.getCopyOfContextMap());
> //some context is set in a different thread
> Executors.newSingleThreadExecutor().execute(new Runnable() {
> public void run() {
> //not needed, but shouldn't break anything in the parent right?
> MDC.setContextMap(contextMap.get());
> logger.info("Check enclosed.");
> }
> });
> //If I don't do this I have lost my context. That seems wrong..
> //MDC.setContextMap(contextMap.get());
> logger.debug("The most beautiful two words in English.");
> }
> {code}
> I'll try to reproduce the issue with some sibling threads for the heck of it, but I \
> think the above already illustrates the problem.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: \
                http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
logback-dev mailing list
logback-dev@qos.ch
http://qos.ch/mailman/listinfo/logback-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic