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.
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
精彩评论