HttpModule to enable logging of unhandled exceptions in web applications.

Namespace:  CuttingEdge.Logging.Web
Assembly:  CuttingEdge.Logging (in CuttingEdge.Logging.dll)

Syntax

Visual Basic (Declaration)
Public Class AspNetExceptionLoggingModule _
	Implements IHttpModule
C#
public class AspNetExceptionLoggingModule : IHttpModule
Visual C++
public ref class AspNetExceptionLoggingModule : IHttpModule
JavaScript
CuttingEdge.Logging.Web.AspNetExceptionLoggingModule = function();

Type.createClass(
	'CuttingEdge.Logging.Web.AspNetExceptionLoggingModule',
	null,
	IHttpModule);

Examples

This example demonstrates how to configure the provider in a web.config to enable logging. You should add the following parts to the web.config:
  1. Add a <section> to the <configSections> section pointing at the LoggingSection class.
  2. Add a <logging> section to the <configuration> section to configure the logging providers to use.
  3. Add the AspNetExceptionLoggingModule to the <httpModules> section of the <system.web> section. This enables a global 'catch all' and logs unhandled exceptions in your web application using the default logging provider you defined in step 2.
The following snippet shows an example of how your web.config might look like.
 Copy Code
  <?xml version="1.0"?>
  <configuration>
      <configSections>
          <section name="logging" type="CuttingEdge.Logging.LoggingSection, CuttingEdge.Logging"
              allowDefinition="MachineToApplication" />
      </configSections>
      <logging defaultProvider="WindowsEventLogLoggingProvider">
          <providers>
              <add  
                  name="WindowsEventLogLoggingProvider"
                  type="CuttingEdge.Logging.WindowsEventLogLoggingProvider, CuttingEdge.Logging"
                     threshold="Information"
                  source="MyWebApplication"
                  logName="MyWebApplication"
                  description="Windows event log logging provider"
              />
          </providers>
      </logging>
      <system.web>
          <httpModules>
              <add name="ExceptionLogger"  
                  type="CuttingEdge.Logging.Web.AspNetExceptionLoggingModule, CuttingEdge.Logging"/>
          </httpModules>
      </system.web>
  </configuration>
  

Inheritance Hierarchy

System..::.Object
  CuttingEdge.Logging.Web..::.AspNetExceptionLoggingModule

See Also