This project is read-only.


Similar to ELMAH, but older, this module is used to log toplevel exceptions. This handler has two major features:
  • Logging the exception details to a database
  • Sending an email message to configured recipients for each exception

Both features are customizable and can be used independent of each other.

Sample Configuration

 <sectionGroup name="goodStuff">
      <section name="exceptionHandlerConfiguration"       type="GoodStuff.Diagnostics.ExceptionHandlerConfigurationSectionHandler, GoodStuff"/>

    <exceptionHandlerConfiguration enabled="true">
      <mailer from="" recipients="">
        <!-- IP Based -->
        <exclude sourceIP=""/>
        <exclude sourceIP=""/>
        <!-- Based on main Exception -->
        <exclude typeName="System.Web.UI.ViewStateException"/>
        <exclude message="Invalid viewstate." compareMethod="Exact"/>
        <exclude message="Ongeldige weergave" compareMethod="Contains"/>
        <exclude message="reference not set to an instance" compareMethod="StartsWith"/>
      <sql connectionName="Database">
        <exclude message="reference not set to an instance" compareMethod="StartsWith"/>

    <add name="GoodStuffDemo" connectionString="Data Source=(LOCAL);Initial Catalog=GoodStuff;Integrated Security=True"/>   

After the configuration, you must add the module to the httpModules.

IMPORTANT: If you run in II7 integrated mode, you must add the module to the <system.Webserver><modules> section!

      <add name="ExceptionLogger" type="GoodStuff.Diagnostics.ExceptionModule, GoodStuff"/>

If you are using the Sql module to log exceptions to the database, here's the SQL script to create the table: LogEntry.sql

Quick Sql Exception Viewer

To be able to view the SQL exception log, you will have to register the viewer handler

      <add verb="GET" path="Exceptions.axd" type="GoodStuff.Diagnostics.ExceptionHandlerSqlViewer, GoodStuff"/>

Access the log by browsing to the /exceptions.axd page of your web site. It is strongly advised to secure access to the page using a <location> section.

Last edited Oct 12, 2011 at 5:01 PM by drblame, version 7


No comments yet.