ElmahR – monitor errors in your app using a dashboard
If your unfamiliar with Elmah and/or ElmahR then please take a quick look here.
If you’re using Elmah but haven’t taken advantage of ElmahR then read on.
If you have one or more application(s) which currently use Elmah then you can very easily add in ElmahR which gives you a superb dashboard from where you can monitor either one or all of you applications which log errors.
The dashboard is basically one webpage which makes very nice use of SignalR to display information regarding errors thrown by your application(s), so if you deploy something and you monitor this page and see the error count for your application counting up quickly then you know you have a problem. You can use the dashboard to monitor a number of applications on different environments for example.
Existing/New Web Application
- Either create a brand new test web application or you can use an existing web application – add ElmahR to this application using the Nuget package as below:-
- Ok now that we have added ElmahR to a web application we need to configure it accordingly, open up the web.config and look for the elmah section, should look something like this:-
- Important – The sourceId setting needs to match the sourceId setting in our dashboard application’s web.config
- Now lets create our dashboard, so create a new MVC or Web application, then add the Nuget package as below:-
- Now we need to edit the dashboard’s web.config so that the sourceId’s match, shown below:-
Testing ElmahR is working
- Within your web application we want to test that ElmahR is set up and working correctly, to do this we need to have an error generated, so deliberately add an exception, such as a throw new NotImplementedException() or similar into an area you can test quickly (e.g. index actionresult within the home controller in MVC)
- Run the dashboard application, which should look something like this:-
- Then run your web application and browse to the page which will generate an error so we can see if it logs as we expect.
- If you have everything configured correctly then you will see the error count change in the dashboard application, like so:-
- If you don’t see your application logging errors on the dashboard it’s usually the sourceId element or the targetUrl element within your web.config
Hope you find this of use and start using ElmahR.
If you get stuck or something isn’t working add a comment.
Nice article, thanks for taking the time to write it 🙂 I just wanted to add one thing: assuming that you have elmah.axd enabled on your source application, then you can use this “out of the box” feature from ELMAH which allows you to raise a test exception in your app just hitting (in your case):
This way you don’t have to build your own failing page/action to test for exceptions.
Then, whatever failing endpoint you have (a custom page/action or elmah.axd/test), you can set that url to the testExceptionUrl attribute in the elmahr configuration, this will add a “skull” icon for you app which will allow you to raise your test exception directly from inside the dashboard. In your screeenshot you already do that, I just wanted to emphasize that with elmah.axd you do not need to build your own failing endpoint for testing purposes, and the “skull” (properly configured) icon can hit that special url for you 🙂
[…] ElmahR – monitor errors in your app using a dashboard (Gregor Suttie) […]
This is a really nice dashboard. I want a similar dashboard for log4net. Would you mind chatting about modularizing the front-end so it can support multiple logging frameworks?
The only thing your dashboard does not give me, that I really like in the log4net community, is the log4net dashboard which presents a pivoted view of the data. It is a lot more dense than your middle column visualization, since it provides an aggregate overview.
Is there a complete sample code on GitHub for download. I have been trying to use ElmahR somehow it is not working. I am unable to track applications errors in one central application. I have followed the step by step guide but still unable to create a dashboard.Any help is appreciated. Thanks