Affects Version/s: 2.11.0
Fix Version/s: None
We are now trying to tune log4j2 to work in GC-Free mode.
One of the filters I'm trying to use is RegexFilter. Based on my observation it does produce garbage (when using with useRawMessage). Documentation (https://logging.apache.org/log4j/2.x/manual/garbagefree.html) states:
"Other filters like BurstFilter, RegexFilter and ScriptFilter are not trivial to make garbage free, and there is currently no plan to change them."
However, I don't think it is difficult, in case if logging is done in single thread (is it the case of Disruptor?) and pattern is constant (which it is)
so instead of doing:
It worth adding matcher into constructor:
and then something like:
It looks like this approach will not work in case of concurrent access to filter. But in case of using Disruptor, there should be single processing thread anyway, that processes RingBufferEvents.
Do you think it possible to somehow extend this filter, or create new one that can be used in case of log event processing after Disruptor?