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 to Chapter 17 to read about creating custom logs and writing log entries to remote machines.)



Visual Basic. NET Power Coding
Visual Basic(R) .NET Power Coding
ISBN: 0672324075
EAN: 2147483647
Year: 2005
Pages: 215
Authors: Paul Kimmel

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net