Details
-
Improvement
-
Resolution: Fixed
-
Minor
-
0.9.28
-
None
Description
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.