Writing to the Event Log
Thus far I have been using console applications to simplify the examples. However, you are more likely to use .NET Remoting for WinForms, WebForms, or NT Service applications. For debugging and tracing information for these applications you can use the event log. Chapter 17 gives more information on using the EventLog class for logging application events, but I'll mention it here briefly.
The easiest way to log application events is to invoke the shared method EventLog.WriteEntry, passing the event source and message to write. The event source is a unique name across all event logs, and the message is whatever text you want to appear in the log entry. By default, information will be written to the Application log. (Refer ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access