[logback-dev] [JIRA] Updated: (LBCLASSIC-301) MDC Adapter with configurable InheritableThreadLocal

Alexander Treptow (JIRA) noreply-jira at qos.ch
Mon Oct 24 10:00:12 CEST 2011


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

Alexander Treptow updated LBCLASSIC-301:
----------------------------------------

    Attachment: LogbackMDCAdapterTest.java

> MDC Adapter with configurable InheritableThreadLocal
> ----------------------------------------------------
>
>                 Key: LBCLASSIC-301
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-301
>             Project: logback-classic
>          Issue Type: Improvement
>          Components: appender
>    Affects Versions: 0.9.28
>            Reporter: Alexander Treptow
>            Assignee: Logback dev list
>            Priority: Minor
>         Attachments: LogbackMDCAdapter.java, LogbackMDCAdapterTest.java
>
>
> In our application we use a sifting file appender to log bot requests to a different log file than normal user requests. We have several sensor and aggregation threads that are started on different times that also have some logging output.
> My Problem:
> Log statements from request-independent threads are posted to bot.log and main.log on random. 
> My Solution:
> I patched the LogbackMDCAdapter to be configureable by a system variable, to disable inheritance of the thread local member "copyOnInheritThreadLocal".
> The patched version defaults to old behavior, so it doesn't change if you do not configure it.
> To disable inheritance of that member, just pass "logback.threadlocal.inherit.copy=false" to the JVM.
> I applied the patch to Version 0.9.28 and tested it with our application. Maybe other logback users also want to configure logback in that way.

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