Can anyone suggest a quick way to tell Elmah not to use the email handler for local requests?
i.e. when Request.IsLocal == true
I don't want to receive an email every time I generate an exception. Alternatively, a way to simply disable elmah altogether for local requests would be good.
I'd prefer an answer that doesn't require that I use a different Web.config locally than I use in production.
You can configure error filtering in ELMAH and express conditions for when an exception should be filtered/excluded from logging and/or mailing. The following error filter should help you to filter out exceptions (as far as ELMAH is concerned) occurring on local requests:
<errorFilter>
<test>
<equal binding="Context.Request.IsLocal"
value="True" type="Boolean" />
</test>
</errorFilter>
For more details, see the wiki on Error Filtering and examples on the ELMAH project site.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With