Changes the configured behavior for writing new entries when the event log reaches its maximum file size.
Assembly: System (in System.dll)
public function ModifyOverflowPolicy( action : OverflowAction, retentionDays : int )
action is not a valid OverflowAction value.
retentionDays is less than one, or larger than 365.
The Log value is not a valid log name.
- or -
The registry key for the event log could not be opened on the target computer.
The overflow behavior for an event log specifies what happens when new entries are to be written to a log that has reached its maximum file size.
The overflow behavior takes effect only when an event log reaches its maximum file size. The overflow behavior does not affect writing a new entry to a log that can accommodate additional event log entries.
The method configures the overflow behavior of an event log. EventLog instance. After calling this method for the event log specified by the Log property, the OverflowAction and MinimumRetentionDays property values reflect the newly configured overflow behavior.
This property represents a configuration setting for the event log represented by this instance. When the event log reaches its maximum size, this property specifies how the operating system handles new entries written by all event sources registered for the event log.
Set the action parameter to OverwriteAsNeeded to indicate that a new entry overwrites the oldest entry when the EventLog reaches its maximum size. If the action parameter is set to OverwriteAsNeeded, the retentionDays parameter value is ignored.
Set the action parameter to OverwriteOlder to indicate that each new entry overwrites older entries when the EventLog reaches its maximum size. Specify the number of days that events must be retained in the log using the retentionDays parameter. Events written within the retention range are not overwritten by new entries.
Setting the overflow policy to DoNotOverwrite specifies that new entries are discarded when the event log is full. If you use this setting, ensure the event log is regularly archived and cleared to avoid reaching its maximum size limit.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.