Monday, 14 December 2015

Elmah filter by exception type


In Elmah there two ways to filter exception

  1. by code
  2. by config
In this post i will just show how to filter exception using config file this is pretty simple 


  <elmah>
    <errorFilter>
      <test>
        <or>
          <equal binding="HttpStatusCode" value="404" type="Int32" />
          <is-type binding="BaseException" type="Namespace.BaseException, AssembyName" />
        </or>
      </test>
    </errorFilter>
  </elmah>

So current config will ignore all 404 and exception who inherited from BaseException.  But note that important thing is that assembly name is specified or elmah will try to search in Elmah assembly which will cause an error
Volodymyr Bilyachat Web Developer