[JIRA] Created: (LBCLASSIC-299) MDC properties sometimes were empty (DBAppender)

MDC properties sometimes were empty (DBAppender) ------------------------------------------------ Key: LBCLASSIC-299 URL: http://jira.qos.ch/browse/LBCLASSIC-299 Project: logback-classic Issue Type: Bug Affects Versions: 0.9.30 Environment: win xp, jdk1.6.0_22, weblogic 10.3.4 Reporter: Bryan Lin Assignee: Logback dev list I put the userId and userName into MDC while login, but sometimes it was not written to DB. After debug I found that while the actual type of "event.getMDCPropertyMap()" is Collections$SynchronizedMap, MDC was not empty; but when it return HashMap, then MDC is empty. -- 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

[ http://jira.qos.ch/browse/LBCLASSIC-299?page=com.atlassian.jira.plugin.syste... ] Ceki Gulcu commented on LBCLASSIC-299: -------------------------------------- Bryan, could you please provide a test case reproducing this issue?
MDC properties sometimes were empty (DBAppender) ------------------------------------------------
Key: LBCLASSIC-299 URL: http://jira.qos.ch/browse/LBCLASSIC-299 Project: logback-classic Issue Type: Bug Affects Versions: 0.9.30 Environment: win xp, jdk1.6.0_22, weblogic 10.3.4 Reporter: Bryan Lin Assignee: Logback dev list
I put the userId and userName into MDC while login, but sometimes it was not written to DB. After debug I found that while the actual type of "event.getMDCPropertyMap()" is Collections$SynchronizedMap, MDC was not empty; but when it return HashMap, then MDC is empty.
-- 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

[ http://jira.qos.ch/browse/LBCLASSIC-299?page=com.atlassian.jira.plugin.syste... ] Bryan Lin commented on LBCLASSIC-299: ------------------------------------- Sorry! I can't repeat this issue in test case! It just happened on my webapp. ps: all the errors were occur in ajax request, and I used log.error() to log it into db.
MDC properties sometimes were empty (DBAppender) ------------------------------------------------
Key: LBCLASSIC-299 URL: http://jira.qos.ch/browse/LBCLASSIC-299 Project: logback-classic Issue Type: Bug Affects Versions: 0.9.30 Environment: win xp, jdk1.6.0_22, weblogic 10.3.4 Reporter: Bryan Lin Assignee: Logback dev list
I put the userId and userName into MDC while login, but sometimes it was not written to DB. After debug I found that while the actual type of "event.getMDCPropertyMap()" is Collections$SynchronizedMap, MDC was not empty; but when it return HashMap, then MDC is empty.
-- 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

[ http://jira.qos.ch/browse/LBCLASSIC-299?page=com.atlassian.jira.plugin.syste... ] Ralph Goers commented on LBCLASSIC-299: --------------------------------------- You said you added the userid and user name into the MDC during login. You need to add them to the MDC on every request and clear the MDC at the end of the request. If you aren't doing that then problems such as what you are experiencing would occur. What we typically do is to create a "SessionContext" Map that contains all the data that is valid for the session and then copy it to the MDC on every request. Since your AJAX call is on a different request, and thus probably a different thread, than the login you would need to follow this pattern.
MDC properties sometimes were empty (DBAppender) ------------------------------------------------
Key: LBCLASSIC-299 URL: http://jira.qos.ch/browse/LBCLASSIC-299 Project: logback-classic Issue Type: Bug Affects Versions: 0.9.30 Environment: win xp, jdk1.6.0_22, weblogic 10.3.4 Reporter: Bryan Lin Assignee: Logback dev list
I put the userId and userName into MDC while login, but sometimes it was not written to DB. After debug I found that while the actual type of "event.getMDCPropertyMap()" is Collections$SynchronizedMap, MDC was not empty; but when it return HashMap, then MDC is empty.
-- 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

[ http://jira.qos.ch/browse/LBCLASSIC-299?page=com.atlassian.jira.plugin.syste... ] Bryan Lin commented on LBCLASSIC-299: ------------------------------------- Tks Ralph! I have tried your method, and the problem was disappeared. please close this issue. thanks again.
MDC properties sometimes were empty (DBAppender) ------------------------------------------------
Key: LBCLASSIC-299 URL: http://jira.qos.ch/browse/LBCLASSIC-299 Project: logback-classic Issue Type: Bug Affects Versions: 0.9.30 Environment: win xp, jdk1.6.0_22, weblogic 10.3.4 Reporter: Bryan Lin Assignee: Logback dev list
I put the userId and userName into MDC while login, but sometimes it was not written to DB. After debug I found that while the actual type of "event.getMDCPropertyMap()" is Collections$SynchronizedMap, MDC was not empty; but when it return HashMap, then MDC is empty.
-- 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

[ http://jira.qos.ch/browse/LBCLASSIC-299?page=com.atlassian.jira.plugin.syste... ] Ceki Gulcu resolved LBCLASSIC-299. ---------------------------------- Resolution: Incomplete
MDC properties sometimes were empty (DBAppender) ------------------------------------------------
Key: LBCLASSIC-299 URL: http://jira.qos.ch/browse/LBCLASSIC-299 Project: logback-classic Issue Type: Bug Affects Versions: 0.9.30 Environment: win xp, jdk1.6.0_22, weblogic 10.3.4 Reporter: Bryan Lin Assignee: Logback dev list
I put the userId and userName into MDC while login, but sometimes it was not written to DB. After debug I found that while the actual type of "event.getMDCPropertyMap()" is Collections$SynchronizedMap, MDC was not empty; but when it return HashMap, then MDC is empty.
-- 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

[ http://jira.qos.ch/browse/LBCLASSIC-299?page=com.atlassian.jira.plugin.syste... ] Ceki Gulcu closed LBCLASSIC-299. -------------------------------- Assignee: Ceki Gulcu (was: Logback dev list)
MDC properties sometimes were empty (DBAppender) ------------------------------------------------
Key: LBCLASSIC-299 URL: http://jira.qos.ch/browse/LBCLASSIC-299 Project: logback-classic Issue Type: Bug Affects Versions: 0.9.30 Environment: win xp, jdk1.6.0_22, weblogic 10.3.4 Reporter: Bryan Lin Assignee: Ceki Gulcu
I put the userId and userName into MDC while login, but sometimes it was not written to DB. After debug I found that while the actual type of "event.getMDCPropertyMap()" is Collections$SynchronizedMap, MDC was not empty; but when it return HashMap, then MDC is empty.
-- 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
participants (3)
-
Bryan Lin (JIRA)
-
Ceki Gulcu (JIRA)
-
Ralph Goers (JIRA)