0

My webconfig has something like this... and I wanted to filter so I only capture 404 errors to my email .. I am using MVC so what is the best way to do that..?

thanks

First time using Elmah

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

 <add name="Elmah.ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
 <add name="Elmah.ErrorMail" type="Elmah.ErrorMailModule" preCondition="managedHandler" />
 </modules>

   ...
   </system.webServer>
   </configuration>

and then

  <elmah>
   <errorMail
        from="me@me.com"
        to="me@me.com"
        subject="my app Error" />
NoviceDeveloper
  • 1,270
  • 3
  • 15
  • 41
  • 1
    There are lots of bots trying to request pages from your site that don't exist. Depending on the popularity of your site you are going to get a lot of emails each day. If you want a better overview of missing pages and alerts sign up for the Google Webmaster Tools (it's free). – ZippyV May 17 '14 at 09:39

1 Answers1

1

Check these:

ELMAH - Filtering 404 Errors https://code.google.com/p/elmah/wiki/ErrorFiltering#Filtering_Declaratively_via_Configuration

Community
  • 1
  • 1
Wasp
  • 3,395
  • 19
  • 37
  • This does not specifically say where I can do that, only send email if 404? – NoviceDeveloper May 19 '14 at 15:08
  • Why you say that? In the second link it's explaining quite clearly how to filter by status code and by module (the mailing one), it's exactly what you need to do, right? Check the *Filtering by Source* section – Wasp May 19 '14 at 15:41