I configure my company's system to have all loggers be asynchronous by setting the system
property Log4jContextSelector
to org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
. We use log4j 2.0.
There is no problem when I run a small input file through the system. But when I ran a bigger input file (our system is supposed to ran much bigger file than this), OutOfMemoryError
is caused. Information is as below:
SEVERE: Exception processing: 14451294 org.apache.logging.log4j.core.async.RingB ufferLogEvent@226dc6bf
java.lang.OutOfMemoryError: Java heap space
Then I increased the max heap size to 4 gigs (total physical memory is 8G) and another problem is caused:
SEVERE: Exception processing: 775221 org.apache.logging.log4j.core.async.RingBufferLogEvent@1c6b80a9
java.lang.OutOfMemoryError: GC overhead limit exceeded
The Log4J team is aware of this: https://issues.apache.org/jira/browse/LOG4J2-414
Update 2018-2-2:
The original problem and the above JIRA ticket were raised 5 years ago against Log4j 2.0-beta9.
This is many years later. The Log4j2 community is about to release Log4j 2.11. Several memory leak bugs have been fixed since version 2.0-beta 9.
If anyone experiences this problem with a recent version of Log4j2 please raise a new JIRA ticket since this should not happen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With