EPiServer CMS 6 with ELMAH

In EPiServer

This blog post is about integrating EPiServer CMS 6 with ELMAH. ELMAH provides functionality to log and view unhandled exceptions that occur on a website. We’’ll use the EPiServer CMS 6 dashboard with an RSS gadget to consume the ELMAH RSS feed.

ELMAH

ELMAH (Error Logging Modules and Handlers) is a pluggable error logging facility that can be added to any ASP.NET application. The beauty of it is that no recompilation is necessary. Simply tweak web.config and add the binaries to the bin folder and you’re good to go!

Just because your website has gone into production it does not necessarily mean that it will be bug-free. Recreating errors that users experience are not always an easy task. ELMAH records all unhandled errors that occur on the website. By clicking the details link we get a more detailed view of the error. 

ELMAH error LogELMAH error log details

These errors can then be viewed through an HTTP handler, RSS feed or ELMAH can mail you when the error occurs.

The alternative would be to use log4net. But you need add logic to global.asax or write your own error-logging module. I advocate using log4net to keep track of events (info, debug, warnings, errors) you know can occur. ELMAH is for the twilight zone where things go bump.

Installing ELMAH

Installing ELMAH is very straightforward. Copy the binaries to your bin folder and modify web.config accordingly. It’s also easy to restrict access to the ELMAH handler.

Here’s how web.config should look.

First the handlers section.

Then the modules section.

ELMAH RSS feed

I’m a fan of the EPiServer CMS 6 online center with the gadgets dashboard. Here we can create a central hub for web editors and administrators to monitor their site. To keep it simple we’ll just add an RSS reader for the ELMAH RSS feed.

But… there’s a snag. ELMAH uses RSS version 0.91. This is not compatible with the RSS feed reader in EPiServer CMS 6. You’ll end up with an error like this.

rss-feed-error

I simply modified the ELMAH source code to specify the RSS version as 2.0 instead. You can download the fix here (x64 release).

ELMAH rss feed

daniel
daniel
Developer
Recent Posts
  • This is really sweet stuff. Will implement this on my next EPiServer website!

  • Cool Martin! 🙂

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Not readable? Change text. captcha txt

Start typing and press Enter to search