ELMAH (Error Logging Modules and Handlers) integration into Kentico CMS

   —   
In this article we’ll see how to integrate ELMAH, which is an open source project whose purpose is to log and report unhandled exceptions in ASP.NET web application. Please see more information about it on its home page
There are lots of articles on how to use ELMAH and fortunately most of them lead to successful finish. However please focus mainly on this one - ELMAH - Error Logging Modules And Handlers which is written nicely and very descriptively.

What we find the most impressive about ELMAH’s integration is that it’s possible to integrate it into Kentico CMS without any need of rebuilding the project or any complicated coding.

1) Please firstly download the package ELMAH-1.1-src.zip  and unpack it on your hard drive. You’ll find files and folders inside. We will be interested especially in BIN folder. Please copy whole content from bin\net-2.0\Release\ folder to your project folder’s bin folder.

2) Then please open your web.config file and add code as follows:
a) To <configSections> section please add this:
<sectionGroup name="elmah">
<section name="errorLog"
type="System.Configuration.SingleTagSectionHandler,
System, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
</sectionGroup>

b) Just after the </configSections> element please place this:
<elmah>
<errorLog type="Elmah.MemoryErrorLog, Elmah" size="50"/>
</elmah>

c) To <httpHandlers> section add this one:
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>

d) And finally to <httpModules> section append this:
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>

And that’s it. Now, when you navigate to <your_domain>/elmah.axd you’ll be able to see ELMAH’s interface - please be patient till the web project is restarted (we’ve just changed web.config and it’s standard reaction).
Just for your reference please see the sample web.config file with those modifications for .NET 3.5.
Please note, this article shows how to integrate ELMAH into Kentico CMS. It is just basic demonstration to make it work. Moreover you can take a look at mentioned articles and adjust it further. It’s completely up to you.

-ov-


See also: Using HTTP Modules and Handlers to Create Pluggable ASP.NET Components
ELMAH: Error Logging Modules and Handlers for ASP.NET (and MVC too!)


Applies to: Kentico CMS 5.0
Share this article on   LinkedIn

Juraj Ondrus

Hi, I am the Technical support leader at Kentico. I'm here to help you use Kentico and get as much as possible out of it.