Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elmah basic setup questions/issues

Tags:

I'm not finding this to be easy to setup; either there is a missing step in the setup configuration, it isn't work correctly, or I don't actually understand it's purpose. There is something definitely wrong here. The problem must obviously be me. I'm just not getting this to work. Here's what I've done.

Create a brand new mvc application. Placed the following on the About.aspx page.

<% throw new Exception("blah"); %> Put content here.

Hit the page get the yellow screen with the exception.

Add elmah.dll to bin directory.

Add to the Web.config file configurationSections:

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

Add to the httpHandlers section the following:

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

Add to the modules section:

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

Add to the handler section:

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

Add an elmah section:

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

What is curious here is that the ".XmlFileErrorLog" part of that string show up red as a ReSharper error indicating that it "Cannot resolve symbol '.ctor'" which when I look at the elmah.dll in Reflector shows this object to require either a "string" or an "IDicationary" in either of the two public constructors.

I'm running Windows Vista x64 with VS 2008. Set permission on the App_Data to Everyone as Co_Owner.

The http://localhost:xxxx/elmah.axd page does come up and shows no errors. When I hit my "About" page again I still see yellow screen and elmah.axd still shows no errors the app_data folder .

I substituted the customerrors with and created associated page:

<customErrors mode="On" defaultRedirect="GenericErrorPage.htm" /> 

The custom page shows but elmah.axd still shows "No Errors". App_data still empty!

As source to start this setup I used: code.google.com/p/elmah/wiki/MVC

So where am I messed up at?

~-=Mike=-~

like image 768
Mike Avatar asked Jun 06 '09 18:06

Mike


People also ask

How do you check Elmah error?

Build the application, run it in the browser, and navigate to http://www.yoursite.com/elmah.axd. You are prompted to log in before you see the content. After a successful authentication, you see a web page to remotely view the entire log of recorded exceptions.

What are Elmah logs?

ELMAH is a free, open source error logging library that includes features like error filtering and the ability to view the error log from a web page, as an RSS feed, or to download it as a comma-delimited file.


1 Answers

Check if ErrorLogModule is present in both configuration/system.web/httpModules (used if you are on Development Web Server) and configuration/system.webServer/modules (used by IIS7). Here is the fragment of web.config from project, I'm currently working on:

<?xml version="1.0"?> <configuration>     <system.web>         <httpModules>             <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>             <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />         </httpModules>     </system.web>     <system.webServer>         <validation validateIntegratedModeConfiguration="false" />         <modules runAllManagedModulesForAllRequests="true">             <remove name="ErrorLog" />             <remove name="ErrorMail" />             <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />             <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />         </modules>     </system.webServer> </configuration> 

Hope this helps

like image 100
eu-ge-ne Avatar answered Oct 24 '22 19:10

eu-ge-ne