You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: xml/System.Diagnostics/EventLog.xml
+20-25
Original file line number
Diff line number
Diff line change
@@ -2510,22 +2510,18 @@ SVC_UPDATE.EXE
2510
2510
<ReturnType>System.Int32</ReturnType>
2511
2511
</ReturnValue>
2512
2512
<Docs>
2513
-
<summary>Gets the number of days to retain entries in the event log.</summary>
2514
-
<value>The number of days that entries in the event log are retained. The default value is 7.</value>
2513
+
<summary>This property is deprecated.</summary>
2514
+
<value>To be added.</value>
2515
2515
<remarks>
2516
-
<formattype="text/markdown"><![CDATA[
2517
-
2518
-
## Remarks
2519
-
Use the <xref:System.Diagnostics.EventLog.MinimumRetentionDays%2A> property to examine the current setting for an event log. Use <xref:System.Diagnostics.EventLog.ModifyOverflowPolicy%2A> to change the minimum number of days that each entry in the event log must be retained.
2520
-
2521
-
The <xref:System.Diagnostics.EventLog.MinimumRetentionDays%2A> value depends on the configured overflow behavior of the event log. If the <xref:System.Diagnostics.OverflowAction> property for an event log is set to <xref:System.Diagnostics.OverflowAction.OverwriteAsNeeded>, then the <xref:System.Diagnostics.EventLog.MinimumRetentionDays%2A> value is 0. If the <xref:System.Diagnostics.OverflowAction> property for an event log is set to <xref:System.Diagnostics.OverflowAction.DoNotOverwrite>, then the <xref:System.Diagnostics.EventLog.MinimumRetentionDays%2A> value is -1. If the <xref:System.Diagnostics.OverflowAction> property for an event log is set to <xref:System.Diagnostics.OverflowAction.OverwriteOlder>, then the <xref:System.Diagnostics.EventLog.MinimumRetentionDays%2A> value is greater than zero, and represents the number of days to retain event log entries when the event log is full.
2516
+
<formattype="text/markdown"><![CDATA[
2517
+
2518
+
## Remarks
2522
2519
2523
-
The overflow behavior only occurs when an event log reaches its size limit. When an <xref:System.Diagnostics.EventLog> has its <xref:System.Diagnostics.EventLog.OverflowAction%2A> set to <xref:System.Diagnostics.OverflowAction.OverwriteOlder>, and the event log reaches its maximum size, then new entries are written only if they can replace entries whose age exceeds the <xref:System.Diagnostics.EventLog.MinimumRetentionDays%2A> period. Retaining event entries for a minimum period is appropriate when the event log is archived regularly. Otherwise, you risk losing new entries when the event log reaches its limit. To avoid losing new event information, set the minimum retention days for events based on your archive schedule for a particular event log.
2524
-
2525
-
2526
-
2527
-
## Examples
2528
-
The following example enumerates the event logs defined on the local computer, and displays configuration details for each event log.
2520
+
> [!IMPORTANT]
2521
+
> Support for the <xref:System.Diagnostics.EventLog.MinimumRetentionDays%2A> property was removed in Windows Vista and later operating systems. Setting this value can cause the Event Log to never overwrite events, and to drop all events to the channel once it is full.
2522
+
2523
+
## Examples
2524
+
The following example enumerates the event logs defined on the local computer, and displays configuration details for each event log.
<paramname="action">The overflow behavior for writing new entries to the event log.</param>
2580
-
<paramname="retentionDays">The minimum number of days each event log entry is retained. This parameter is used only if <paramrefname="action" /> is set to <seecref="F:System.Diagnostics.OverflowAction.OverwriteOlder" />.</param>
2575
+
<paramname="action">The overflow behavior for writing new entries to the event log. Must not be `OverwriteOlder`.</param>
2576
+
<paramname="retentionDays">Deprecated. Must be 0.</param>
2581
2577
<summary>Changes the configured behavior for writing new entries when the event log reaches its maximum file size.</summary>
2582
2578
<remarks>
2583
2579
<formattype="text/markdown"><![CDATA[
@@ -2586,23 +2582,22 @@ SVC_UPDATE.EXE
2586
2582
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.
2587
2583
2588
2584
> [!NOTE]
2589
-
> 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.
2585
+
> 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.
2590
2586
2591
2587
The <xref:System.Diagnostics.EventLog.ModifyOverflowPolicy%2A> method configures the overflow behavior of an event log. <xref:System.Diagnostics.EventLog> instance. After calling this method for the event log specified by the <xref:System.Diagnostics.EventLog.Log%2A> property, the <xref:System.Diagnostics.EventLog.OverflowAction%2A> and <xref:System.Diagnostics.EventLog.MinimumRetentionDays%2A> property values reflect the newly configured overflow behavior.
2592
2588
2593
2589
> [!NOTE]
2594
-
> 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.
2590
+
> 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.
2591
+
2592
+
Set the `action` parameter to <xref:System.Diagnostics.OverflowAction.OverwriteAsNeeded> to indicate that a new entry overwrites the oldest entry when the <xref:System.Diagnostics.EventLog> reaches its maximum size. If the `action` parameter is set to <xref:System.Diagnostics.OverflowAction.OverwriteAsNeeded>, the `retentionDays` parameter value is ignored.
2595
2593
2596
-
Set the `action` parameter to <xref:System.Diagnostics.OverflowAction.OverwriteAsNeeded> to indicate that a new entry overwrites the oldest entry when the <xref:System.Diagnostics.EventLog> reaches its maximum size. If the `action` parameter is set to <xref:System.Diagnostics.OverflowAction.OverwriteAsNeeded>, the `retentionDays` parameter value is ignored.
2594
+
Set the `action` parameter to <xref:System.Diagnostics.OverflowAction.DoNotOverwrite> to discard new events when the maximum log size is reached. If the `action` parameter is set to <xref:System.Diagnostics.OverflowAction.DoNotOverwrite>, the `retentionDays` parameter value is ignored.
2597
2595
2598
-
Set the `action` parameter to <xref:System.Diagnostics.OverflowAction.OverwriteOlder> to indicate that each new entry overwrites older entries when the <xref:System.Diagnostics.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.
2599
-
2600
-
Set the `action` parameter to <xref:System.Diagnostics.OverflowAction.DoNotOverwrite> to discard new events when the maximum log size is reached. If the `action` parameter is set to <xref:System.Diagnostics.OverflowAction.DoNotOverwrite>, the `retentionDays` parameter value is ignored.
2596
+
> [!WARNING]
2597
+
> Never set the `action` parameter to <xref:System.Diagnostics.OverflowAction.OverwriteOlder>. This value is deprecated and might cause the log to behave as if the `DoNotOverwrite` parameter was passed instead.
2601
2598
2602
2599
> [!CAUTION]
2603
-
> Setting the overflow policy to <xref:System.Diagnostics.OverflowAction.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.
2604
-
2605
-
2600
+
> Setting the overflow policy to <xref:System.Diagnostics.OverflowAction.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.
2606
2601
2607
2602
## Examples
2608
2603
The following example displays the configured overflow policy for a specified event log, and allows the user to select a new overflow policy setting for the event log.
Copy file name to clipboardExpand all lines: xml/System.Diagnostics/OverflowAction.xml
+7-6
Original file line number
Diff line number
Diff line change
@@ -38,12 +38,13 @@
38
38
39
39
- New entries will be discarded.
40
40
41
-
- New entries will overwrite older entries.
42
-
43
-
- New entries will either be discarded or will overwrite existing entries depending upon the age of the existing entries.
41
+
- New entries will overwrite older entries.
44
42
45
43
Use the <xref:System.Diagnostics.EventLog.ModifyOverflowPolicy%2A> method to set the overflow behavior for an <xref:System.Diagnostics.EventLog>. Check the current configured behavior of an <xref:System.Diagnostics.EventLog> through its <xref:System.Diagnostics.EventLog.OverflowAction%2A> property.
46
44
45
+
> [!WARNING]
46
+
> The `OverwriteOlder` behavior is deprecated. Using this value might cause the Event Log to behave as if the `DoNotOverwrite` value was used instead, which will cause events to be discarded when the log is full.
47
+
47
48
## Examples
48
49
49
50
The following example enumerates the event logs defined on the local computer and displays configuration details for each event log.
@@ -149,17 +150,17 @@ The following example enumerates the event logs defined on the local computer an
149
150
</ReturnValue>
150
151
<MemberValue>1</MemberValue>
151
152
<Docs>
152
-
<summary>Indicates that new events overwrite events older than specified by the <seecref="P:System.Diagnostics.EventLog.MinimumRetentionDays" /> property value when the event log is full. New events are discarded if the event log is full and there are no events older than specified by the <seecref="P:System.Diagnostics.EventLog.MinimumRetentionDays" /> property value.</summary>
153
+
<summary>This field is deprecated.</summary>
153
154
<remarks>
154
155
<formattype="text/markdown"><![CDATA[
155
-
156
+
> [!WARNING]
157
+
> Do not use this value. Doing so might cause the Event Log to behave as if the `DoNotOverwrite` value was used instead.
0 commit comments