in src/log4net/Repository/LoggerRepositorySkeleton.cs [478:529]
public bool Flush(int millisecondsTimeout)
{
if (millisecondsTimeout < -1)
{
throw new ArgumentOutOfRangeException(nameof(millisecondsTimeout),
"Timeout must be -1 (Timeout.Infinite) or non-negative");
}
// Assume success until one of the appenders fails
bool result = true;
// Use DateTime.UtcNow rather than a System.Diagnostics.Stopwatch for compatibility with .NET 1.x
DateTime startTimeUtc = DateTime.UtcNow;
// Do buffering appenders first. These may be forwarding to other appenders
foreach (IAppender appender in GetAppenders())
{
if (appender is not IFlushable flushable)
{
continue;
}
if (appender is BufferingAppenderSkeleton)
{
int timeout = GetWaitTime(startTimeUtc, millisecondsTimeout);
if (!flushable.Flush(timeout))
{
result = false;
}
}
}
// Do non-buffering appenders.
foreach (IAppender appender in GetAppenders())
{
if (appender is not IFlushable flushable)
{
continue;
}
if (appender is not BufferingAppenderSkeleton)
{
int timeout = GetWaitTime(startTimeUtc, millisecondsTimeout);
if (!flushable.Flush(timeout))
{
result = false;
}
}
}
return result;
}