When you write an entry to an event log, you specify the message you want to write to the log as a string. A message should contain all information needed to interpret what caused the problem and what to do to correct the problem.
The following conditions must be met in order to successfully write a log entry:
Note You must set the Source property on your EventLog component before you can write entries to a log. When your component writes an entry, the system automatically checks to see if the source you specified is registered with the event log to which the component is writing, and calls CreateEventSource if needed.
You can specify several parameters when you write an entry, including the type of entry you're making, an ID that identifies the message, a category, and any binary data you want to append to the entry. For more information on the properties associated with an entry, see EventLog Members.
To write an event log entry
Note If you have already registered the source with the event log to which you want to write an entry, you need only set the Source property in this step.
[Visual Basic] EventLog1.WriteEntry("This is a simple event log entry") [C#] EventLog1.WriteEntry ("This is a simple event log entry");
Introduction to the EventLog Component | Configuring EventLog Components | Creating EventLog Components | EventLog Members