Question

My understanding is that raising an errorsignal should log my error or hit the custom HandleErrorWithELMAHAttribute class(taken from this example) ,But it does neither.

I am using the HandleErrorWithElmah decorator for the controller in question.The error logging works when it comes to unhandled exceptions in the controller(I am explicitly calling Logexception and not using conditions mentioned in the second code block of example). But the error signalling feature which is to be used for handled errors is keeping me baffled. How does error signalling work...Is it supposed to do something other than Logging...If so how can i use it log my handled exceptions?

This is the code i am using to signal handled errors

ErrorSignal.FromCurrentContext().Raise(new Exception("Some Handled Error")); 

And below are snippets of my settings in 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="yes" />
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="Log" />
</elmah>



<httpHandlers>
    <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
<httpModules>
    <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
</httpModules>
Was it helpful?

Solution

I'm using Elmah with .NET MVC and raising Elmah exceptions programmically works for me. I may be clutching a straws here but from looking at the fourth comment down on this page on the Elmah site there are a couple of lines included in the Web.config that aren't in your example above.

It could be that you just didn't include the lines in your snippet, but I thought I'd throw it out there anyway

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top