On 2018-01-09 14:46, Apache <[email protected]> wrote:
> The Logging api only allows you to log a single event at a time so it
> doesn?019t make sense for an appender to have a method that accepts multiple
> events since it can?019t 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?
As I wrote, the use case would be performance, assuming that the
Appender can process a bunch of messages just as quickly as a single
message. (Think of the JMSAppender using a BatchMessage, rather than a
TextMessage, or ObjectMessage.)
My trivial guess would be, that the AsyncAppender somewhere has code
like the following:
private void pushToSyncAppender(LogEvent[] events) {
final Appender appender = this.syncAppender;
for (LogEvent ev : events) {
appender.append(ev);
}
}
which could be changed to
private void pushToSyncAppender(LogEvent[] events) {
final Appender appender = this.syncAppender;
if (appender instanceof BatchableAppender) {
((BatchableAppender) appender).append(events);
} else {
for (LogEvent ev : events) {
appender.append(ev);
}
}
}
I have to admit, though, that I don't detect right now, where the
AsyncAppender is actually pushing to the synchronous appender.
Jochen