Logging in .NET

The .NET runtime provides access to the Windows 2000 event log system. This access eases your ability to record, audit, and troubleshoot problems and other events that occur during application execution. You can use four main Event Log events: application, system, security, and custom events.

The .NET runtime allows developers to create instances of the EventLog class to log events. The EventLog class also overloads the WriteEntry() method with static versions, so you can make entries without creating an instance of the EventLog class. The syntax looks like this:

EventLog.WriteEntry("Source goes here.", "A message goes here." , EventLogEntryType
.Information);

Figure 19.6 shows how the preceding code line would appear in the ...

Get Building e-Commerce Sites with the .NET Framework 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.