in src/log4net/Repository/LoggerRepositorySkeleton.cs [595:630]
public bool Flush(int millisecondsTimeout)
{
if (millisecondsTimeout < -1) throw new ArgumentOutOfRangeException("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(log4net.Appender.IAppender appender in GetAppenders())
{
log4net.Appender.IFlushable flushable = appender as log4net.Appender.IFlushable;
if (flushable == null) continue;
if (appender is Appender.BufferingAppenderSkeleton)
{
int timeout = GetWaitTime(startTimeUtc, millisecondsTimeout);
if (!flushable.Flush(timeout)) result = false;
}
}
// Do non-buffering appenders.
foreach (log4net.Appender.IAppender appender in GetAppenders())
{
log4net.Appender.IFlushable flushable = appender as log4net.Appender.IFlushable;
if (flushable == null) continue;
if (!(appender is Appender.BufferingAppenderSkeleton))
{
int timeout = GetWaitTime(startTimeUtc, millisecondsTimeout);
if (!flushable.Flush(timeout)) result = false;
}
}
return result;
}