NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Creating and Removing Custom Event Logs

You can use the EventLog class to create a custom event log on a local or remote computer. You might create a custom log if you wanted to organize your entries in a more granular way than is allowed when your components write entries to the default Application log. For example, suppose you have a component called OrderEntry that writes entry information to an event log. You are interested in backing up and saving these entries for a longer period of time than some other entries in the Application log. Rather than registering your component to write to the Application log, you can create a custom log called OrdersLog and register your component to write entries to that log instead. That way, all of your order information is stored in one place and will not be affected if the entries in the Application log are cleared.

You can use the CreateEventSource method to create a custom log. If you try to write to a log that does not already exist, the system automatically creates a custom log for you and registers your component as a source for that log.

Note   You remove a custom log the same way you remove any log — by calling the Delete method. For details, see Deleting Event Logs.

It is important to note the difference between creating an event log and creating an instance of the EventLog component. When you use the CreateEventSource method, you are creating a new custom event log in Windows, rather than a component in your project or application. When you create an instance of the EventLog component, you create a component inside your Visual Studio project that references an external event log.

You can view custom logs in the Windows 2000 Computer Management window.

To create a custom event log on the local machine

To create a custom event log on a remote machine

See Also

Administering Event Logs | Deleting Event Logs