BufferedWebEventProvider.ProcessEventFlush Method (WebEventBufferFlushInfo)

 

Processes the buffered events.

Namespace:   System.Web.Management
Assembly:  System.Web (in System.Web.dll)

public abstract void ProcessEventFlush(
	WebEventBufferFlushInfo flushInfo
)

Parameters

flushInfo
Type: System.Web.Management.WebEventBufferFlushInfo

A WebEventBufferFlushInfo that contains buffering information.

The ProcessEventFlush method processes the messages that have been buffered. ASP.NET health monitoring calls the method when the flushing of the buffer is required. The intervals at which flushing is required is determined by the parameter value of the bufferMode attribute in the providers element in the healthMonitoring configuration section.

The following code example shows how to implement the ProcessEventFlush method.


// Processes the messages that have been buffered.
// It is called by the ASP.NET when the flushing of 
// the buffer is required.
public override void ProcessEventFlush(
    WebEventBufferFlushInfo flushInfo)
{

    // Customize event information to be sent to 
    // the Windows Event Viewer Application Log.
    customInfo.AppendLine(
        "SampleEventLogWebEventProvider buffer flush.");

    customInfo.AppendLine(
        string.Format("NotificationType: {0}",
        GetNotificationType(flushInfo)));

    customInfo.AppendLine(
        string.Format("EventsInBuffer: {0}",
        GetEventsInBuffer(flushInfo)));

    customInfo.AppendLine(
        string.Format(
        "EventsDiscardedSinceLastNotification: {0}",
        GetEventsDiscardedSinceLastNotification(flushInfo)));


    // Read each buffered event and send it to the
    // Application Log.
    foreach (WebBaseEvent eventRaised in flushInfo.Events)
        customInfo.AppendLine(eventRaised.ToString());

    // Store the information in the specified file.
    StoreToFile(customInfo, logFilePath, FileMode.Append);
}

.NET Framework
Available since 2.0
Return to top
Show: