[
https://issues.apache.org/jira/browse/LOG4J2-1010?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Remko Popma resolved LOG4J2-1010.
---------------------------------
Resolution: Fixed
Fixed the issue by returning a constant empty map instead of creating a new
empty instance for each call to {{getMutableContextData}}.
This brings performance in line with slf4j.
*Empty ThreadContext*
{noformat}
t=1
Benchmark (size) Mode
Samples Score Error Units
o.a.l.l.p.j.MDCFilterBenchmark.log4jThreadContextFilter 0 sample
59275 46.046 ± 2.354 ns/op
o.a.l.l.p.j.MDCFilterBenchmark.slf4jMDCFilter 0 sample
74809 27.697 ± 1.562 ns/op
t=2
Benchmark (size) Mode
Samples Score Error Units
o.a.l.l.p.j.MDCFilterBenchmark.log4jThreadContextFilter 0 sample
144048 48.797 ± 1.444 ns/op
o.a.l.l.p.j.MDCFilterBenchmark.slf4jMDCFilter 0 sample
115524 43.704 ± 1.527 ns/op
t=4
Benchmark (size) Mode
Samples Score Error Units
o.a.l.l.p.j.MDCFilterBenchmark.log4jThreadContextFilter 0 sample
256148 69.658 ± 4.635 ns/op
o.a.l.l.p.j.MDCFilterBenchmark.slf4jMDCFilter 0 sample
291767 60.737 ± 1.212 ns/op
{noformat}
*ThreadContext with 4 elements*
{noformat}
t=1
Benchmark (size) Mode
Samples Score Error Units
o.a.l.l.p.j.MDCFilterBenchmark.log4jThreadContextFilter 4 sample
81807 49.223 ± 1.992 ns/op
o.a.l.l.p.j.MDCFilterBenchmark.slf4jMDCFilter 4 sample
69460 86.525 ± 2.642 ns/op
t=2
Benchmark (size) Mode
Samples Score Error Units
o.a.l.l.p.j.MDCFilterBenchmark.log4jThreadContextFilter 4 sample
103624 88.992 ± 2.531 ns/op
o.a.l.l.p.j.MDCFilterBenchmark.slf4jMDCFilter 4 sample
108786 87.334 ± 2.152 ns/op
t=4
Benchmark (size) Mode
Samples Score Error Units
o.a.l.l.p.j.MDCFilterBenchmark.log4jThreadContextFilter 4 sample
335807 91.768 ± 1.245 ns/op
o.a.l.l.p.j.MDCFilterBenchmark.slf4jMDCFilter 4 sample
326588 94.174 ± 1.308 ns/op
{noformat}
> Injectable context properties
> -----------------------------
>
> Key: LOG4J2-1010
> URL: https://issues.apache.org/jira/browse/LOG4J2-1010
> Project: Log4j 2
> Issue Type: Improvement
> Components: Core
> Affects Versions: 2.2
> Reporter: Mikael Ståldal
> Assignee: Remko Popma
> Fix For: 2.7
>
> Attachments: properties.patch
>
>
> It would be useful to have a way to inject context properties into a
> {{LogEvent}}, as an alternative to {{ThreadContext}}.
> In an asynchronous environment, using ThreadContext as currently implemented
> is not so useful since JVM threads might not be coupled to the logical flow
> of the application.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]