Prevents the logging of events from occurring.

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

Syntax

Visual Basic (Declaration)
Public Class TerminatorLoggingProvider _
	Inherits LoggingProviderBase
C#
public class TerminatorLoggingProvider : LoggingProviderBase
Visual C++
public ref class TerminatorLoggingProvider : public LoggingProviderBase
JavaScript
CuttingEdge.Logging.TerminatorLoggingProvider = function();

Type.createClass(
	'CuttingEdge.Logging.TerminatorLoggingProvider',
	CuttingEdge.Logging.LoggingProviderBase);

Remarks

The default behavior of CuttingEdge.Logging is to let exceptions, caused by a failing provider, bubble up the call stack. The philosophy of CuttingEdge.Logging is that a failing provider is a serious problem and should not be ignored. For this reason CuttingEdge.Logging contains the notion of FallbackProviders. When a provider fails, the original event (and the exception thrown by the provider) will be routed to the fallback provider. In certain scenario's however, developers want the application to be more robust and continue execution, even when logging fails. This can be the case when no suited fallback provider is available or the fallback provider could also fail. While these scenario's should be rare, the TerminatorLoggingProvider enables this. By using a TerminatorLoggingProvider, events going through that provider will get trashed and the application continues execution.

The TerminatorLoggingProvider will always return null after a call to Log.

The table below shows the list of valid attributes for the TerminatorLoggingProvider configuration:

AttributeDescription
name The name of the provider. This attribute is mandatory.
description A description of the provider. This attribute is optional.
Note that the fallbackProvider and threshold attributes are not valid for this type of provider.

The attributes can be specified within the provider configuration. See the example below on how to use.

Examples

This example demonstrates how to specify values declaratively for several attributes of the logging section, which can also be accessed as members of the LoggingSection class. The following configuration file example shows how to specify values declaratively for the logging section.

In this example a TerminatorLoggingProvider is configured as fallback provider to prevent a possible exception caused by a failing provider to bubble up the call stack.

 Copy Code
  <?xml version="1.0"?>
  <configuration>
      <configSections>
          <section name="logging" allowDefinition="MachineToApplication"
              type="CuttingEdge.Logging.LoggingSection, CuttingEdge.Logging" />
      </configSections>
      <connectionStrings>
          <add name="SqlLoggingConnection"  
              connectionString="Data Source=.;Integrated Security=SSPI;Initial Catalog=Logging;" />
      </connectionStrings>
      <logging defaultProvider="SqlLoggingProvider">
          <providers>
              <add  
                  name="SqlLoggingProvider"
                  type="CuttingEdge.Logging.SqlLoggingProvider, CuttingEdge.Logging"
                  fallbackProvider="Terminator"
                  connectionStringName="SqlLoggingConnection"
              />
              <add  
                  name="Terminator"
                  type="CuttingEdge.Logging.TerminatorLoggingProvider, CuttingEdge.Logging"
              />
          </providers>
      </logging>
  </configuration>
  

Inheritance Hierarchy

System..::.Object
  System.Configuration.Provider..::.ProviderBase
    CuttingEdge.Logging..::.LoggingProviderBase
      CuttingEdge.Logging..::.TerminatorLoggingProvider

See Also