in src/log4net/Appender/AppenderSkeleton.cs [387:447]
public void DoAppend(LoggingEvent[] loggingEvents)
{
// This lock is absolutely critical for correct formatting
// of the message in a multi-threaded environment. Without
// this, the message may be broken up into elements from
// multiple thread contexts (like get the wrong thread ID).
lock(this)
{
if (m_closed)
{
ErrorHandler.Error("Attempted to append to closed appender named ["+m_name+"].");
return;
}
// prevent re-entry
if (m_recursiveGuard)
{
return;
}
try
{
m_recursiveGuard = true;
ArrayList filteredEvents = new ArrayList(loggingEvents.Length);
foreach(LoggingEvent loggingEvent in loggingEvents)
{
if (FilterEvent(loggingEvent))
{
filteredEvents.Add(loggingEvent);
}
}
if (filteredEvents.Count > 0 && PreAppendCheck())
{
this.Append((LoggingEvent[])filteredEvents.ToArray(typeof(LoggingEvent)));
}
}
catch(Exception ex)
{
ErrorHandler.Error("Failed in Bulk DoAppend", ex);
}
#if !MONO && !NET_2_0 && !NETSTANDARD
// on .NET 2.0 (and higher) and Mono (all profiles),
// exceptions that do not derive from System.Exception will be
// wrapped in a RuntimeWrappedException by the runtime, and as
// such will be catched by the catch clause above
catch
{
// Catch handler for non System.Exception types
ErrorHandler.Error("Failed in Bulk DoAppend (unknown exception)");
}
#endif
finally
{
m_recursiveGuard = false;
}
}
}