ElmahR is a web dashboard where you can aggregate several ASP.NET web applications you want to monitor in case they raise unhandled exceptions; adding them to the configuration of a dashboard instance will enable them to post error, which will be shown in real-time on all connected clients.
How does it work?
In order to use ElmahR you have to enable ELMAH on the ASP.NET web application you have to monitor, and configure it to post errors to ElmahR. This way you'll leverage all the great logging features that ELMAH already has. To do that you will need the ErrorPostModule for ELMAH, which is part of ElmahR project and is not part of official ELMAH.
A monitored application in theory has not to be an ASP.NET application, it could be a desktop client, a mobile app, it could even be developed on a non-.NET platform, as long as it can post data over HTTP. Nevertheless the only fully implemented supported scenario is when applications to be monitored are ASP.NET web sites/applications. You can still implement different missing scenarios by yourself, it should be a quite easy task to do.
When an error arrives to ElmahR, after being posted as described earlier, ElmahR's server side code uses SignalR to redistribute it to all the connected clients. Errors reach clients as JSON structures resembling the ELMAH data format, and are finally processed to be visualized.
How is it structured?
Both client and server portions of ElmahR are modular. The Core portion takes care of basic error dispatching, and supplies a very basic textual log page, while the Dashboard module adds a more sophisticated and organized user interface, delivering real-time experience in form of error boxes smoothly appearing as soon as errors occur, and with simple statistics about how many errors have been observed. Error descriptions are clickable, causing an error details window to pop up. You can also do some basic client-side filtering: you can block error types you are not interested about, or stop error messages from specific applications, just click the play/pause icon corresponding to the error type or application you want to stop/resume.
More modules are available to tackle different problem contexts, like errors persistence or inversion of control.
How do I install ElmahR
Using ElmahR implies deploying a dashboard instance first, and then connecting the applications you want to monitor to the dashboard.
Preparing a Dashboard
A dashboard should be a separate applications from the monitored ones, you should not have the dashboard page directly inside an existing web application you want to monitor, although it is technically possible and not difficult. That's to keep things cleaner and safer. You will not need to install one dashboard for each monitored applications, a single dashboard can aggregate more than one source.
There are several available options to prepare a dashboard:
- Geek option: Clone the code from this repository and compile it, the solution named ElmahR will give you a full dashboard.
- Sysadmin option: Go to the downloads section to see if there is some packaged distribution ready. Those will be published every now and then to help figuring out how to set up a dashboard, reflecting the status of the code at the time of the publication. With the bits unzipped in a folder, you will create a web site or a virtual directory pointing at it, and configure it under an ASP.NET 4.0 app pool with integrated pipeline (you could also use IIS Express, especially for testing). Please follow the instructions available in the README inside the zipped file.
- Nuget option (NEW! Available with 1.0.0 final): Create a new ASP.NET project (Webforms, MVC and Webpages are all supported), or use an existing one, and add the necessary ElmahR modules from Nuget. For more details about the available packages and how to use them please go to the corresponding section. Both .NET Framework 4.0 and 4.5 are supported.
Adding ErrorPostmodule to each web application to be monitored
ErrorPostModule is made available by ElmahR.Elmah assembly, and it's configured as any other ELMAH module. When properly configured it will extend ELMAH so that errors will be posted to the configured dashboard. For more details about how to configure it see the related section.
The assembly and the related module could be quite easily installed manually, but a Nuget package is available to make it even easier. The package will take care of the dependency on ELMAH and will prepare the configuration file appropriately. Please go to the Nuget packages section for more details.
How do I configure ElmahR
Now that you have everything in place, let's see how you can configure a dashboard and a monitored application. If you will use the Nuget packages you will have most of the configuration bits listed below already in place, you will only need to customize them with the actual values for your specific setup.
You will need to declare the configuration section first:
<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <section name="elmahr" type="ElmahR.Core.Config.SectionHandler, ElmahR" /> </configSections> ... </configuration>
Then you will need the
elmahr section and add to it as many
application sections as the web apps you will want to monitor here:
<elmahr> ... <application name="Sample application" sourceId="SomeCode" testExceptionUrl="http://foo.com/elmah.axd/test" /> ... </elmahr>
The relevant thing here is the
sourceId attribute, which will be used to match the corresponding source application.
Each monitored app will have ELMAH properly configured, and the ErrorPostModule from ElmahR.Elmah available, then you will need to configure properly:
<configuration> <configSections> <sectionGroup name="elmah"> ... <section name="errorPost" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" /> </sectionGroup> </configSections> <elmah> ... <errorPost targetUrl="http://dashbord.mycompany.com/posterror.axd" sourceId="SomeCode" infoUrl="http://foo.com/elmah.axd" /> </elmah> <system.webServer> <validation validateIntegratedModeConfiguration="false" /> <modules runAllManagedModulesForAllRequests="true"> ... <add name="ErrorPost" type="ElmahR.Elmah.ErrorPostModule, ElmahR.Elmah" /> </modules> ... </system.webServer> ... </configuration>
The relevant things here are:
- the ErrorPostModule module added to the available HTTP modules
targetUrlattribute for the
elmahsection, which is the address of the destination dashboard to which errors will be posted
sourceIdattribute for the
elmahsection, which will be used to match the corresponding configured application in the dashboard
More details about all the available options can be found here.
Details about ElmahR architecture can be found here.
More about Elmahr
Latest releases are available here.
- Bug fixes in Nuget packages
- Cross Domain support
1.0.2 & 1.0.3 & 1.0.4
- Bug fixes
1.0.1 (Core only) (2013-03-29)
- Bootstrap phase reviewed to better handle version 4.0 and 4.5 of .NET Framework
- Dependencies reviewed
- Dashboard now is split in several modules, and has been reorganized accordingly
- Nuget packages for dashboard modules available
- Dashboard is extensible with new modules
- CSS & JS bundling and minification introduced
- Upgraded to SignalR 1.0
- Replaceable IoC container for dependencies resolution (integrated with SignalR
- Enhancements and bug fixes
- Error post encryption available
- MongoDBPersistor released
- Persistence writes happen asynchronously
- Historical errors stats and cleanup
- Low level logging
- Plugin system
- Appharbor integration
- User setting persistence
- SignalR groups implemented
- Connection status diagnostics
- ELMAH Test Exception support
Big thanks to JetBrains for supporting ElmahR and other open-source projects by providing a free license for their awesome WebStorm IDE.