2

Currently on ELMAH error logs, we want to eliminate/remove 404 errors since this is useless and consuming our database storage.

Any idea how to exclude the 404, especially through the web.config?

Hishaam Namooya
  • 1,071
  • 1
  • 11
  • 22
  • Possible duplicate of [Elmah reporting unwanted 404 errors](http://stackoverflow.com/questions/2071389/elmah-reporting-unwanted-404-errors) – Rosdi Kasim Mar 25 '16 at 15:12

1 Answers1

4

You can easily skip 404 errors by having the below set on the web configuration file of your site:

    <elmah>
    <security allowRemoteAccess="yes" />
    <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="Elmah-ErrorLog" applicationName="YourAPPName" />
    <errorFilter>
        <test>
            <or>
                <regex binding="Exception.Message" pattern="Server cannot modify cookies after HTTP headers have been sent\." />
                <equal binding="HttpStatusCode" value="404" type="Int32" />
            </or>
        </test>
    </errorFilter>
</elmah>