This is an on-demand post. Original post you can find here.
For this experiment, I have used a new web application on visual studio 2008.
1. Download latest version from http://elmah.googlecode.com/
2. Reference the Elmah.dll file from the downloaded files (Eg: \ELMAH-1.0-BETA3-bin\bin\net-3.5\Elmah.dll)
3. Add below code in your web.config file - under configuration node:
<sectiongroup name="elmah">
<section name="security" requirepermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
<section name="errorLog" requirepermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
<section name="errorMail" requirepermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
<section name="errorFilter" requirepermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
</sectiongroup>
4. Now add http handler - in the node:
<add type="Elmah.ErrorLogPageFactory, Elmah" verb="POST,GET,HEAD" path="elmah.axd" />
5. Now enable the logging feature. For that add the below line in node:
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
In this point you can test the error page: http://yourhost/yoursite_path/elmah.axd
6. Default storage of errors will be 'memory' you can choose other available methods also - XML files, SQLLite and SQL Server. Here I will use SQL Server.
7. Add this inside node. Make sure you have a valid connection string already defined.
<errorlog type="Elmah.SqlErrorLog, Elmah" connectionstringname="Your_Connection_String_Name" />
8. Execute the \ELMAH-1.0-BETA3-bin\db\SQLServer.sql file from SQL Server Management studio.
9. Everything done. There are many options available. Research!
Additional notes:
If you use URL re-writing features in asp.net then you willl have to use this also in web.config:
<location path="elmah.axd">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>