Tip WriteEntry can be called in a variety of ways. The overloads that have more arguments will cause more data to be stored in the event log.
Also The extra data should be used if it will be useful in diagnosing issues through the event logs.
public partial class Form1 : Form
private void Form1_Load(object sender, EventArgs e)
eventLog1.Source = "test";
eventLog1.WriteEntry("Dot Net Perls article being written.");
eventLog1.WriteEntry("Please stand by while article continues.",
eventLog1.WriteEntry("This website is being worked on.",
Discussion. The WriteEvent method requires an EventInstance. With an EventInstance, you need an integer that corresponds to a string in a separate resource file.
Tip The event log can be located by browsing to Control Panel, System and Maintenance, Administrative Tools, View event logs.
Summary. The EventLog type can be used to write entries to the system event log. After assigning the Source, you can call WriteEntry (or WriteEvent) to write messages to the system.
Dot Net Perls is a collection of tested code examples. Pages are continually updated to stay current, with code correctness a top priority.
Sam Allen is passionate about computer languages. In the past, his work has been recommended by Apple and Microsoft and he has studied computers at a selective university in the United States.
This page was last updated on Sep 28, 2022 (edit).