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
+7-11
Original file line number
Diff line number
Diff line change
@@ -3353,7 +3353,7 @@ SVC_UPDATE.EXE
3353
3353
Use this method to write an entry of a specified <xref:System.Diagnostics.EventLogEntryType> to the event log. The `type` is indicated by an icon and text in the Type column in the Event Viewer for a log.
3354
3354
3355
3355
> [!NOTE]
3356
-
> The `message` string cannot contain %*n*, where *n* is an integer value (for example, %1), because the event viewer treats it as an insertion string. Because an Internet Protocol, version 6 (IPv6) address can contain this character sequence, you cannot log an event message that contains an IPv6 address.
3356
+
> The `message` string cannot contain %*n*, where *n* is an integer value (for example, %1), because the event viewer treats it as an insertion string. Because an Internet Protocol, version 6 (IPv6) address can contain this character sequence, you cannot log an event message that contains an IPv6 address.
3357
3357
3358
3358
You must set the <xref:System.Diagnostics.EventLog.Source%2A> property on your <xref:System.Diagnostics.EventLog> component before you can write entries to the log. You must create and configure the event source before writing the first entry with the source.
3359
3359
@@ -3377,9 +3377,7 @@ SVC_UPDATE.EXE
3377
3377
> If you write an entry to a remote computer, the value of the message (the text string) might not be what you expect if the remote computer is not running the .NET Framework.
3378
3378
3379
3379
> [!NOTE]
3380
-
> If the `message` parameter contains a NUL character, the message in the event log is terminated at the NUL character.
3381
-
3382
-
3380
+
> If the `message` parameter contains a NUL character, the message in the event log is terminated at the NUL character.
3383
3381
3384
3382
## Examples
3385
3383
The following example writes a warning entry to an event log, "MyNewLog", on the local computer.
@@ -3464,6 +3462,7 @@ SVC_UPDATE.EXE
3464
3462
<formattype="text/markdown"><![CDATA[
3465
3463
3466
3464
## Remarks
3465
+
3467
3466
Use this method to write an information entry to the event log, using a source that is already registered as an event source for the appropriate log. If you want to specify any other <xref:System.Diagnostics.EventLogEntryType>, use a different overload of <xref:System.Diagnostics.EventLog.WriteEntry%2A>.
3468
3467
3469
3468
You must create and configure the event source before writing the first entry with the source. Create the new event source during the installation of your application. This allows time for the operating system to refresh its list of registered event sources and their configuration. If the operating system has not refreshed its list of event sources, and you attempt to write an event with the new source, the write operation will fail. You can configure a new source using an <xref:System.Diagnostics.EventLogInstaller>, or using the <xref:System.Diagnostics.EventLog.CreateEventSource%2A> method. You must have administrative rights on the computer to create a new event source.
@@ -3473,11 +3472,9 @@ SVC_UPDATE.EXE
3473
3472
If your application writes entries using both resource identifiers and string values, you must register two separate sources. For example, configure one source with resource files, and then use that source in the <xref:System.Diagnostics.EventLog.WriteEvent%2A> method to write entries using resource identifiers to the event log. Then create a different source without resource files, and use that source in the <xref:System.Diagnostics.EventLog.WriteEntry%2A> method to write strings directly to the event log using that source.
3474
3473
3475
3474
> [!NOTE]
3476
-
> If the `message` parameter contains a NUL character, the message in the event log is terminated at the NUL character.
3475
+
> If the `message` parameter contains a NUL character, the message in the event log is terminated at the NUL character.
3477
3476
>
3478
-
> The `message` string cannot contain %*n*, where *n* is an integer value (for example, %1), because the event viewer treats it as an insertion string. Because an Internet Protocol, version 6 (IPv6) address can contain this character sequence, you cannot log an event message that contains an IPv6 address.
3479
-
3480
-
3477
+
> The `message` string cannot contain %*n*, where *n* is an integer value (for example, %1), because the event viewer treats it as an insertion string. Because an Internet Protocol, version 6 (IPv6) address can contain this character sequence, you cannot log an event message that contains an IPv6 address.
3481
3478
3482
3479
## Examples
3483
3480
The following example creates the source `MySource` if it does not already exist, and writes an entry to the event log `MyNewLog`.
@@ -4370,6 +4367,7 @@ SVC_UPDATE.EXE
4370
4367
<formattype="text/markdown"><![CDATA[
4371
4368
4372
4369
## Remarks
4370
+
4373
4371
Use this method to write a localized entry to the event log. You specify the event properties with resource identifiers rather than string values. The Event Viewer uses the resource identifiers to display the corresponding strings from the localized resource file for the <xref:System.Diagnostics.EventLog.Source%2A>. You must register the source with the corresponding resource file before you write events using resource identifiers.
4374
4372
4375
4373
The input `instance` instance specifies the event message and properties. Set the <xref:System.Diagnostics.EventInstance.InstanceId%2A> of the `instance` input for the defined message in the source message resource file. You can optionally set the <xref:System.Diagnostics.EventInstance.CategoryId%2A> and <xref:System.Diagnostics.EventInstance.EntryType%2A> of the `instance` input to define the category and event type of your event entry. You can also specify an array of language-independent strings to insert into the localized message text. Set `values` to `null` if the event message does not contain formatting placeholders for replacement strings.
@@ -4383,9 +4381,7 @@ SVC_UPDATE.EXE
4383
4381
If your application writes entries using both resource identifiers and string values, you must register two separate sources. For example, configure one source with resource files, and then use that source in the <xref:System.Diagnostics.EventLog.WriteEvent%2A> method to write entries using resource identifiers to the event log. Then create a different source without resource files, and use that source in the <xref:System.Diagnostics.EventLog.WriteEntry%2A> method to write strings directly to the event log using that source.
4384
4382
4385
4383
> [!NOTE]
4386
-
> If you write an entry to a remote computer, the value of the `message` string might not be what you expect if the remote computer is not running the .NET Framework. Also, the `message` string cannot contain %*n*, where *n* is an integer value (for example, %1), because the event viewer treats it as an insertion string. Because an Internet Protocol, version 6 (IPv6) address can contain this character sequence, you cannot log an event message that contains an IPv6 address.
4387
-
4388
-
4384
+
> If you write an entry to a remote computer, the value of the `message` string might not be what you expect if the remote computer is not running .NET. Also, the `message` string cannot contain %*n*, where *n* is an integer value (for example, %1), because the event viewer treats it as an insertion string. Because an Internet Protocol, version 6 (IPv6) address can contain this character sequence, you cannot log an event message that contains an IPv6 address.
4389
4385
4390
4386
## Examples
4391
4387
The following example writes two audit entries to the event log `myNewLog`. The example creates a new event source and a new event log if they do not exist on the local computer. The event message text is specified using a resource identifier in a resource file.
0 commit comments