Manages storage of Logging information to the Windows event log.

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

Syntax

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

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

Remarks

Returning an identifier for the logged event is not appropriate for this provider. This provider will always return null (Nothing in VB) from the Log method.

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

AttributeDescription
name The name of the provider. This attribute is mandatory.
description A description of the provider. This attribute is optional.
fallbackProvider A fallback provider that this provider will use when logging failed. The value must contain the name of an existing logging provider. This attribute is optional.
threshold The logging threshold. The threshold limits the number of events logged. The threshold can be defined as follows: Debug < Information < Warning < Error < Critical. i.e., When the threshold is set to Information, events with a severity of Debug will not be logged. When no value is specified, all events are logged. This attribute is optional.
source The source name to register and use when writing to the event log. This is the source name by which the application is registered on the local computer. This attribute is mandatory.
logName The name of the log where the source's entries are written to. Possible values include: Application, System, or a custom event log. This attribute is mandatory.
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.
 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="Warning"
                  source="MyApplication"
                  logName="MyApplication"
                  description="Windows event log logging provider"
              />
          </providers>
      </logging>
  </configuration>
  

Inheritance Hierarchy

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

See Also