ElmahEventProvider: Sample for using ELMAH with health monitoring of ASP.NET 2.0

144 views
Skip to first unread message

Eric

unread,
Jul 26, 2007, 3:34:58 PM7/26/07
to ELMAH
I have build a sample provider which reroutes events from health
monitoring to ELMAH.
This allows to display all the message and events in common way in
ELMAH as HTML or RSS.


Please give us feedback, so we can decide how to go on.
Is it useful?
Should ELMAH show these events at all?
..

Thanks for helping.

Download:
http://groups.google.com/group/elmah/web/ElmahEventProvider_v0.1.ZIP

Content of readme.txt:

ElmahEventProvider: Sample provider for health monitoring
=========================================================
Eric Schoenholzer, Bluesware Ltd
26. July 2007 20:28:50
V0.1


Goals of ElmahEventProvider
---------------------------
- Give a sample how to use Health monitoring infrastructure of ASP.NET
2.0 to display events in ELMAH
- Use existing ELMAH architecture (HTML, RSS, etc)


Implementation
--------------
The provider is inherited from BufferedWebEventProvider,
which would allow buffering of the events before they are written to
ELMAH.
In ELMAH the events are treated as "HealthEventException" and logged
this way.

Con:
Events are treated as "pseudo exception".

Changes in ELMAH:
Added new exception (HealthEventException.cs)

Provider as separate DLL:
See project(or ElmahEventProvider.cs)


Sample
------
In the sample there's a web site which shows the use of it (No
configuration or compilation needed):

1. Open the web site in the browser
2. Navaigate to /elmah.axd and you will see the events

For ease of use the MemoryErrorLog of ELMAH is used, so that no
database configuration is needed.
But you will lose the log after restarting the web/application.

The standard configuration for ELMAH and HealthMonitoring is used.

For enabling logging, add the ElmahEventProvider as provider to the
health monitoring section and define a routing rule:

<healthMonitoring enabled="true" heartbeatInterval="0">
<rules>
<add name="Application Lifetime Events" eventName="All Events"
provider="ElmahEventProvider" profile="Default" minInterval="00:00:01"/
>
</rules>
<providers>
<add name="ElmahEventProvider" type="Elmah.ElmahEventProvider,
ElmahEventProvider" buffer="false" bufferMode="" />
</providers>
</ healthMonitoring >

Reply all
Reply to author
Forward
0 new messages