# Configure ELMAH on your site

1. Install the *ELMAH on SQL Server* package from the [NuGet repository](http://www.nuget.org/packages/elmah.sqlserver/).

   > info  **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](https://www.nuget.org/packages/elmah/).
2. Make sure the `elmah` section group is added inside the `<configSections>` tag in the `web.config` file. 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>
   ```

   > info  **NOTE**: Мake sure the `Elmah.dll` file is loaded in the `bin` folder of your Sitefinity CMS web application.
3. Complete the installation of the `ELMAH.SqlServer`:
   1. Create a new database to host ELMAH.
   2. Run the `Elmah.SqlServer.sql` script against an empty ELMAH database.

      > info  **NOTE**: You can find the script in the ELMAH GitHub repository [Downloads section](https://elmah.github.io/downloads/). Download the *Sources* `ZIP` file.
4. Open the `web.config` file of your application and perform the following transformations:
   ```XML
   

   <connectionStrings>
       <add name="elmah-sqlserver" connectionString="Data Source=****;User ID=****;Password=****;Initial Catalog=****;" providerName="System.Data.SqlClient" />
   </connectionStrings>

   

   <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
             
   

   <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
   ```
5. (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](http://smtp4dev.codeplex.com/) and configure it to listen on *port 26*.\
   To do this, in your `web.config` file, 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>
   ```
6. (Optional) Register ELMAH handler by adding the following code line in the `<handlers>` and the `<httpHandlers>` sections in the `web.config` file:

   ```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](https://www.progress.com/documentation/sitefinity-cms/test-error-logging-with-elmah).
7. To turn on ELMAH, navigate to *Administration » Settings » Advanced » System » UI Elmah Config*.
8. Select the *IsElmahLoggingTurnedOn* checkbox and click *Save changes*.\
   Every time you change the selection of this checkbox, you must restart the application.

   > info  **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.
