Tag: Elmahr

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:-
    ElmahR
  • 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:-
  • elmah1

  • Important – The sourceId setting needs to match the sourceId setting in our dashboard application’s web.config

DashBoard

  • Now lets create our dashboard, so create a new MVC or Web application, then add the Nuget package as below:-
    ElamhrDash
  • Now we need to edit the dashboard’s web.config so that the sourceId’s match, shown below:-
    elmahr3

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:-

    elmahr5

  • 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:-
    elmahr6

TroubleShooting

  • 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.




ElmahR – Elmah fused With SignalR

If your using Elmah then you’ll be familiar with most of this blog post, if not then don’t worry Elmah stands for Error Logging Modules and Handlers and is used to log unhandled exceptions to the file system, event log, databases or even have it email you the errors.

ElmahR was created by Roberto Vespa (@wasp_twit) and his blog on ElmahR can be found at:- Roberto’s blog

The basics – ElmahR uses Elmah and SignalR to create a dashboard page where you can monitor any unhandled exceptions in all of the applications you have running which use Elmah, that means if you have 5 websites in production you can have one web page monitor them all.

ElmahR Dashboard

To view an example dashboard running on app harbor.

ElmahR uses SignalR which again you can read more on Scott hanselman’s blog

Now lets see how we go about setting this up to work with a new MVC 3 project – the same steps apply to adding it to an existing web application.

  • Create a brand new web application, mvc or normal web app works fine.
  • Using Nuget add the following packages to your blank MVC solution, so add Elmah and JQuery.
  • Once both added follow the configurations steps here
  • You can install the Nuget Package:- ElmahRSource