Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ELMAH.axd is browsable but will never log any of my errors?

I have it all set up and I can browse to /elmah.axd but I have been causing all these errors and it won't log any of them, it just says 'no errors logged'... what the heck did I do wrong?

Here is the stuff I have added to 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" />     
  </sectionGroup>
</configSections>

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

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

<elmah>
  <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data" />
  <security allowRemoteAccess="yes" />
</elmah>

ALSO: This was already at the start of my RegisterRoutes()

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

I read that it doesn't matter any more with ASP.NET MVC 1.0 though, supposedly (per ELMAH website...)

like image 376
MetaGuru Avatar asked Feb 28 '23 20:02

MetaGuru


2 Answers

The config seems to be in order; my best guess is that your IIS web application user doesn't have permission to write to App_Data. If you've locked down permissions, the application user will have read, but not write, permissions there.

You can open permissions up or log to another directory outside of the web path (which is a bit safer IMO) and make sure that read/write permissions for the user are set there.

like image 188
48klocs Avatar answered May 01 '23 08:05

48klocs


The Solution recipe

I installed from nuget elmah and elmah on XML log, didn't got the expected funcionality although I could access http://localhost/elmah.axd, but no error capturing.

I gave write permission to the account IIS_IUSERS in the folder APP_DATA and it started working for HTTP 404 errors and the errors that are outside MVC infrastructure. But it did not log exceptions inside the mvc. The solution was installing elmah.mvc package from nuget and it started capturing all exceptions.

If your config is OK, then just install the elmah.mvc package from nuget and it should start storing logs also inside mvc, not just HTTP 404.

like image 25
visar_uruqi Avatar answered May 01 '23 07:05

visar_uruqi