[logback-dev] [JIRA] Assigned: (LBCLASSIC-275) LoggingEvent casts to LogbackMDCAdapter without checking

Ceki Gulcu (JIRA) noreply-jira at qos.ch
Thu Jun 9 21:51:51 CEST 2011


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

Ceki Gulcu reassigned LBCLASSIC-275:
------------------------------------

    Assignee: Ceki Gulcu  (was: Logback dev list)

> LoggingEvent casts to LogbackMDCAdapter without checking
> --------------------------------------------------------
>
>                 Key: LBCLASSIC-275
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-275
>             Project: logback-classic
>          Issue Type: Bug
>    Affects Versions: 0.9.28
>            Reporter: Chris Dolan
>            Assignee: Ceki Gulcu
>
> LoggingEvent has this code:
>     // ugly but under the circumstances acceptable
>     LogbackMDCAdapter logbackMDCAdapter = (LogbackMDCAdapter) MDC
>         .getMDCAdapter();
>     mdcPropertyMap = logbackMDCAdapter.getPropertyMap();
> I'm trying to build a logback implementation of the OSGi pax-logging-service (http://www.ops4j.org/projects/pax/logging/index.html). But I've got a problem that PAX exports org.slf4j.impl with their own MDC adapter that fails this cast. Theirs has the nice feature that the OSGi bundle context is automatically added to the MDC (at a performance cost, alas).  I'd like to see LoggingEvent changed to something like the following for improved flexibility:
>    MDCAdapter mdc = MDC.getMDCAdapter();
>    if (MDCAdaptor instanceof LogbackMDCAdapter)
>        mdcPropertyMap = ((LogbackMDCAdapter)mdc).getPropertyMap();
>    else
>        mdcPropertyMap = mdc.getCopyOfContextMap();

-- 
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

        


More information about the logback-dev mailing list