jakarta-eelog4j2java.util.concurrentlmax

Concern over using log4j2 AsynchronousLoggers in Java EE application


I would like to employ Log4j2 Asynchronous loggers within an Java EE 7 Applicatiosn.

This entails using the LMAX disruptor-3.0.0.jar or higher on the classpath.

I am concerned this breaks the rule related to starting "user" threads within a Java EE container.

Does the log4j2 automatic configuartion detect the presence of a Jee container? or do I need to pass log4j2 ManagedExecutorService? to use in WorkerPool?


Solution

  • You might be right that using Async Loggers (or AsyncAppender, for that matter) breaks the J2EE rules. At the moment Log4j 2 creates its own ExecutorService (with a call to Executors.newSingleThreadExecutor).

    I recommend that you create a feature request ticket on the Log4j 2 Jira to propose adding the ability for user code (or configuration) to specify a ManagedExecutorService for use by the Disruptor.