public void DoAppend()

in src/log4net/Appender/AppenderSkeleton.cs [330:380]


  public void DoAppend(LoggingEvent[] loggingEvents)
  {
    loggingEvents.EnsureNotNull();

    // 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 (LockObj)
    {
      if (_isClosed)
      {
        ErrorHandler.Error("Attempted to append to closed appender named [" + Name + "].");
        return;
      }

      // prevent re-entry
      if (_recursiveGuard)
      {
        return;
      }

      try
      {
        _recursiveGuard = true;

        var filteredEvents = new List<LoggingEvent>(loggingEvents.Length);

        foreach (LoggingEvent loggingEvent in loggingEvents)
        {
          if (FilterEvent(loggingEvent))
          {
            filteredEvents.Add(loggingEvent);
          }
        }

        if (filteredEvents.Count > 0 && PreAppendCheck())
        {
          Append(filteredEvents);
        }
      }
      catch (Exception e) when (!e.IsFatal())
      {
        ErrorHandler.Error("Failed in Bulk DoAppend", e);
      }
      finally
      {
        _recursiveGuard = false;
      }
    }
  }