Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

ASP.NET Health Monitoring - Building an EventLogWebEventProvider - Part 3

0.00/5 (No votes)
14 Apr 2010 1  
ASP.NET Health Monitoring - Building an EventLogWebEventProvider

In my previous posts on this health monitoring series, I explain to you how and why I made my own EventLogWebEventProvider and which benefits you can achieve by using this provider or by making your own.

Now I'll write about how to use this new provider in one application.

Well, almost everything has been written about this topic and Microsoft has one good article on "How To: Use Health Monitoring in ASP.NET 2.0", so I won't even try to explain all the possible scenarios and configurations. I will simply explain the standard scenario.

Typically I simply want to keep track of two Web Event types:

  1. the ones related to application errors
  2. and the others related to application life cycle

As far as I notice, there are many people that simply track those from point 1.

Another decision to make is where to store these Web Events data. You do this by choosing a Web Event provider.

ASP.NET gives us out-of-the-box several providers and you can make your own provider. Once your provider is done, you can use it just like all the others.

In this example, I will use the newly created provider.

Now that I know exactly what to track and where to store it, I can update my configuration.

All health monitoring configuration data is stored in the system.web\healthMonitoring section and my standard configuration will look like:

XML
<healthMonitoring enabled="true">  
    <providers>    
        <add name="ExtendedEventLogWebEventProvider" 
	type="NG.Web.Management.EventLogWebEventProvider, 
	NG.Web" source="MyEvtLogSource" />  
    </providers>  
    <rules>    
    <clear />    
        <add name="Application Lifetime Events Default" 
	eventName="Application Lifetime Events" 
	provider="ExtendedEventLogWebEventProvider" profile="Default" />    
        <add name="All Errors Default" eventName="All Errors" 
	provider="ExtendedEventLogWebEventProvider" profile="Default" />  
    </rules>
</healthMonitoring>

Notice the source attribute from the ExtendedEventLogWebEventProvider, using it you can set which EventLog source to use.

Remember that when you create an EventLog source, you can choose to create a brand new EventLog and if you so choose, all entries written by this provider in this application context will be isolated from all the others providing one easy way for visual tracking and filtering.

With the health monitoring data in place, you should now be able to see the entries appearing in EventLog.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here