IFlushable Flush Method | Apache log4net™ SDK Documentation

Flushes any buffered log data.

Namespace: log4net.Appender
Assembly: log4net (in log4net.dll) Version: 2.0.8.0-.NET 4.0
Syntax

C#
VB
C++
F#
Copy

    bool Flush(
    	int millisecondsTimeout
    )

    Function Flush (
    	millisecondsTimeout As Integer
    ) As Boolean

    bool Flush(
    	int millisecondsTimeout
    )

    abstract Flush :
            millisecondsTimeout : int -> bool

#### Parameters

millisecondsTimeout
  Type: System
  Int32
  The maximum time to wait for logging events to be flushed.

#### Return Value

Type: Boolean
True if all logging events were flushed successfully, else false.
Remarks

Appenders that implement the Flush(Int32) method must do so in a thread-safe manner: it can be called concurrently with the DoAppend(LoggingEvent) method.

Typically this is done by locking on the Appender instance, e.g.:

Copy

    public bool Flush(int millisecondsTimeout)
    {
        lock(this)
        {
            // Flush buffered logging data
            ...
        }
    }

The millisecondsTimeout parameter is only relevant for appenders that process logging events asynchronously, such as RemotingAppender.

See Also

#### Reference

IFlushable Interface
log4net.Appender Namespace