Hi Adam, On Wed, 10 Apr 2024 at 00:11, Thomas, Adam <adamt...@amazon.com.invalid> wrote: > I created a pull request[1] late last year for this, and was encouraged to > start a discussion on the dev list at the time.
Be reassured that we didn't forget about your PR, we just have a lot of changes going on to publish Log4j Core 3.x. > We run log4j2 on a lot of hosts that are operated by different teams. By > default, our users use async logging and use the Discard > asyncQueueFullPolicy. As far as I can tell, the status logger gets one WARN > message the first time an event is discarded, and during shutdown a TRACE > message is emitted if any discards happened. This leaves us with essentially > no insight as to whether or not events are actually being discarded, when > they are being discarded, or how many we are discarding. What version of Java are you using? If it is Java 17 or later, you could use Log4j Core 3.x that is based on a small dependency injection implementation. While this technical detail is of no importance to most users, in your case you could use an `InstancePostProcessor`[1] to intercept the creation of each service class (AsyncQueueFullPolicy in your case) and instrument it. If you are running Java 8 or Java 11, you can still configure Log4j Core to use your own implementation of `AsyncQueueFullPolicy` by setting the `log4j2.asyncQueueFullPolicy` system property. Piotr [1] https://github.com/apache/logging-log4j2/blob/main/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/di/spi/InstancePostProcessor.java