Configure ELMAH on your site
-
Install the ELMAH on SQL Server package from the NuGet repository.
NOTE: ELMAH on SQL Server package is version 1.2. It has a dependency to the ELMAH package, which must be version 1.2.2. You can also install the ELMAH NuGet package, version 1.2.2, from the NuGet repository.
-
Make sure the
elmahsection group is added inside the<configSections>tag in theweb.configfile. If not, add the section group manually:XML<sectionGroup name="elmah"> <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" /> <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" /> <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" /> <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" /> </sectionGroup>NOTE: Мake sure the
Elmah.dllfile is loaded in thebinfolder of your Sitefinity CMS web application. -
Complete the installation of the
ELMAH.SqlServer:-
Create a new database to host ELMAH.
-
Run the
Elmah.SqlServer.sqlscript against an empty ELMAH database.NOTE: You can find the script in the ELMAH GitHub repository Downloads section. Download the Sources
ZIPfile.
-
-
Open the
web.configfile of your application and perform the following transformations:XML<!-- Find the following connection string and replace the asteriks with the correct entries --> <connectionStrings> <add name="elmah-sqlserver" connectionString="Data Source=****;User ID=****;Password=****;Initial Catalog=****;" providerName="System.Data.SqlClient" /> </connectionStrings> <!-- In the <httpModules> section, add the following line: --> <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" /> <!-- In the <modules> section, add the following line: --> <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" /> -
(Optional) To send email notifications for each error at the time it occurs, you must configure your SMTP settings.
If you do not have an SMTP server, you can download the open source smtp4dev and configure it to listen on port 26.
To do this, in yourweb.configfile, after the<configSections>tag, add the following:XML<system.net> <mailSettings> <smtp deliveryMethod ="Network"> <network host="localhost" port="26" /> </smtp> </mailSettings> </system.net> <elmah> <errorMail from="testemail@domain.com" to="youremail@domain.com" async="true" useSsl="false" /> </elmah> -
(Optional) Register ELMAH handler by adding the following code line in the
<handlers>and the<httpHandlers>sections in theweb.configfile:XML<add name="Elmah" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />For more information about the ELMAH error logging handler, see Test error logging with ELMAH.
-
To turn on ELMAH, navigate to Administration » Settings » Advanced » System » UI Elmah Config.
-
Select the IsElmahLoggingTurnedOn checkbox and click Save changes.
Every time you change the selection of this checkbox, you must restart the application.NOTE: When the ELMAH logging is turned off, the standard logging is working and you can see all the logging information in
App_Data/Sitefinity/Logs. When you select the IsElmahLoggingTurnedOn checkbox, all logging information is transferred to ELMAH.