I guess that you are supposed to use LogEvent.isEndOfBatch() to know when to flush log events to final destination.

Our file and stream based appenders do that. See https://github.com/apache/logging-log4j2/blob/master/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RandomAccessFileAppender.java#L156


On 2018-01-09 14:46, Apache wrote:
The Logging api only allows you to log a single event at a time so it doesn’t 
make sense for an appender to have a method that accepts multiple events since 
it can’t happen. That said, appenders can queue the events and send them 
downstream in batches. I believe some of the appenders do that now.

Is there some use case I am not aware of where this method could be called?

Ralph

On Jan 9, 2018, at 6:02 AM, Jochen Wiedmann <jochen.wiedm...@gmail.com> wrote:

Hi,

currently writing my first appender, and wondering about the following:

The Appender interface specifies a method for logging a single event.
However, my custom Appender would greatly benefit in terms of
performance, if I could implement an additional method
append(LogEvent[] events). Now, I wonder if such batching has been
omitted from the API intentionally. Or, alternatively, if I might
replace my custom logger with a modified instance of AsyncAppender?

Reply via email to