Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Does anyone have ELMAH working with SharePoint 2010? I have the assembly in the bin folder and have what I believe to be the correct entries in the web.config file. I can run the test at http://localhost/elmah.axd/test and generate the test error and can display the error reporting page at http://localhost/elmah.axd but it does not show any errors. I have ELMAH currently configured to retain errors in memory. There was mention in an article about the order of elements in httpModules which I have verified. The site is running on Windows Server 2008 R2 SP1 with SharePoint 2010 Foundation and IIS 7. Below are the entries from my web.config:

   <configSections>
   <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>
   </configSections>
   <Elmah>
    <security allowRemoteAccess="1" />
    <!--<errorlog type="Elmah.XmlFilerErrorLog, Elmah" logPath="~/App_Data" />-->
    <errorLog type="Elmah.MemoryErrorLog, Elmah" size="50" />
   </Elmah>
   <system.web>    
   <httpHandlers>
     <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
   </httpHandlers>    
   <httpModules>
     <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
     <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
     <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
   </httpModules>    
   </system.web>
   <system.webServer>    
   <handlers>     
     <add name="Elmah" verb="POST,GET,HEAD" path="elmah.axd" preCondition="integratedMode" type="Elmah.ErrorLogPageFactory, Elmah" />           
   </handlers>
   </system.webServer>
share|improve this question

2 Answers 2

up vote 1 down vote accepted

Since you're using IIS7, you need to put the handlers and modules nodes in the system.webserver node instead of system.web node.

share|improve this answer
    
That was what I needed. It is now working. thanks –  JDM Apr 26 '11 at 17:33

Following are the config entries that needs to added in web.config of the web application

Add under configsection
<configSections>
 <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>
</configSections>

Add connectionstring section 

<connectionStrings>
<add name="elmah-express" connectionString="Data Source=[server name];Initial Catalog=  [ELMAH_customlogging];User ID=testuser;Password=Welcome1;" />

</connectionStrings>

Add elmah section just below the connectionstring section
<elmah>

<security allowRemoteAccess="0" />

<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="elmah-express" />
</elmah>

Add handler and module entry in httphandlers and httpmodules section under system.web

<httpHandlers>

<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>

</httpHandlers>

<httpModules>

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

 Add handler and module entry in handlers and modules section under system.webserver

 <modules runAllManagedModulesForAllRequests="true">



  <remove name="ErrorLog"/>

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

  <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />

  <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />

  <add name="ErrorTweet" type="Elmah.ErrorTweetModule, Elmah" preCondition="managedHandler" />
  </modules>

  <handlers>

  <add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />

  </handlers>

Please refer below link for elmah implementation in SharePoint

http://sidsharethoughts.blogspot.in/2014/08/implement-elmah-custom-logging-in.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.