Hi,

there is a performance issue in Log4j2 2.22.1 compared to 2.22.0.

I upgraded just the two files log4j-api-2.22.1.jar and log4j-core-2.22.1.jar, 
no other file.
As an example, in my application, the streaming of about 460 MB slowed down 
from about 10-15 seconds
to more than 1000 seconds.
Parts of this can surely be explained by an inefficient internal stream 
manipulation implementation,
which does certains things more often than necessary. However, with 2.22.0 this 
doesn't cause problems. 
And also outside of that sub-optimal streaming, everything is slower, 
measurable for instance
in the range of about 270 milliseconds instead of about 80 millis.

Note, this happens even though effectively just two lines are really logged.
If DEBUG or TRACE were enabled in the loggers, then tens if not hundreds of 
thousands of lines would be logged - so definitely,
there is a lot of logging going on.

This has to do with the org.apache.logging.log4j.ThreadContext.
If I remove just the following one line from my code, then the performance is 
back at normal.

ThreadContext.put(key, value);

So I think this could have been caused by issue 2238
(Avoid a slow exception catch in JdkMapAdapterStringMap constructor #2238).


Kind regards

Andreas

Reply via email to