Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-24

Programmatic flush of BufferingAppenderSkeleton buffer

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.9
    • Fix Version/s: 1.2.10
    • Component/s: Appenders
    • Labels:
      None

      Description

      Programmatic flush of BufferingAppenderSkeleton buffer

      The BufferingAppenderSkeleton holds a buffer of events which are to be delivered to the appender subclass via the SendBuffer method. This buffer currently cannot be programmatically flushed to the appender.

      It should be trivial to add support for a void Flush() method to the BufferingAppenderSkeleton class.

        Issue Links

          Activity

          Hide
          nicko Nicko Cadell added a comment -

          Using this method it should be possible to write a simple method to flush all the appenders:

          private static void FlushAllAppenders()
          {
          foreach(log4net.Appender.IAppender appender in log4net.LogManager.GetRepository().GetAppenders())
          {
          log4net.Appender.BufferingAppenderSkeleton buffer = appender as log4net.Appender.BufferingAppenderSkeleton;
          if (buffer != null)

          { buffer.Flush(); }

          }
          }

          Show
          nicko Nicko Cadell added a comment - Using this method it should be possible to write a simple method to flush all the appenders: private static void FlushAllAppenders() { foreach(log4net.Appender.IAppender appender in log4net.LogManager.GetRepository().GetAppenders()) { log4net.Appender.BufferingAppenderSkeleton buffer = appender as log4net.Appender.BufferingAppenderSkeleton; if (buffer != null) { buffer.Flush(); } } }
          Hide
          nicko Nicko Cadell added a comment -

          Added public virtual void BufferingAppenderSkeleton.Flush() method.

          Show
          nicko Nicko Cadell added a comment - Added public virtual void BufferingAppenderSkeleton.Flush() method.
          Hide
          nicko Nicko Cadell added a comment -

          This issue may be alleviated by the addition of a programmatic API for flushing the buffer held by the BufferingAppenderSkeleton. While this is not a general solution for all appenders and all types of output buffering I am going to leave this issue open.

          Show
          nicko Nicko Cadell added a comment - This issue may be alleviated by the addition of a programmatic API for flushing the buffer held by the BufferingAppenderSkeleton. While this is not a general solution for all appenders and all types of output buffering I am going to leave this issue open.

            People

            • Assignee:
              nicko Nicko Cadell
              Reporter:
              nicko Nicko Cadell
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development