Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elmah filter 404 errors from emails but log to Database

I am using Elmah to log errors in the DB and send an email of the error. I have created a filter to not send 404 page errors by email but this is also filtering them from the DB.

How do I create a filter to prevent certain errors being sent by email but will allow them to be logged in the DB?

I would prefer a web.config solution.

Update:

I wouldn't mind any solution.

like image 421
skyfoot Avatar asked Aug 04 '11 10:08

skyfoot


1 Answers

In web.config elmah section add:

<errorFilter>
<test>
  <and>
    <equal binding="HttpStatusCode" value="404" type="Int32" />
    <regex binding="FilterSourceType.Name" pattern="mail" />
  </and>
</test>
</errorFilter>

You can find the wiki here:

http://code.google.com/p/elmah/wiki/ErrorFiltering

like image 94
Kevin McPhail Avatar answered Nov 14 '22 23:11

Kevin McPhail