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 ...

Get Visual Basic® .NET Power Coding now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.