ELMAH not logging in ASP.NET MVC 2

Posted by PsychoCoder on Stack Overflow See other posts from Stack Overflow or by PsychoCoder
Published on 2011-01-13T23:47:37Z Indexed on 2011/01/13 23:53 UTC
Read the original article Hit count: 503

Filed under:
|
|

I cannot figure out what I'm doing wrong here, trying to use ELMAH in my MVC 2 application and it doesnt log anything, ever.

Here's what I have in my web.config (relevant parts)

<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>

<elmah>
  <security allowRemoteAccess="0" />
  <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ELMAH.SqlServer" />
  <!-- 
  <errorMail from="[email protected]" to="[email protected]" cc="" subject="Elmah Error" async="true" smtpPort="25" smtpServer="[EmailServerName]" userName="" password="" />
  <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" />
  -->
</elmah>


<connectionStrings>
  ...
  <add
      name="ELMAH.SqlServer"
      connectionString="data source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ELMAH_Logging.mdf;Integrated Security=SSPI;Connect Timeout=30;User Instance=True;"
      providerName="System.Data.SqlClient"/>
</connectionStrings>  

<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="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
      ...
    </httpModules>
</system.Web>



<system.webServer>
   <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
    </modules>
    <handlers>
      <add name="Elmah" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>
      ...
    </handlers>
</system.webServer>

Then using the code from DotNetDarren.com but no matter what I do no exceptions are ever logged?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc-2