Skip to content

Common.Logging.ETWLogger

Steve Bohlen edited this page May 30, 2016 · 7 revisions

Common.Logging.ETWLogger

Common.Logging.ETWLogger provides an adapter for connecting Common.Logging to the Event-Tracing for Windows logging subsystem that is available on later editions of the Windows Operating System (both Servers and Clients). See MSDN for more information on Event-Tracing for Windows.

Quick-Start

  1. Add the Common.Logging.ETWLogger NuGet package to your project.
  2. To configure the logger in code, simply create an instance of the Common.Logging.ETW.ETWLoggerAdapter and call the .GetLogger(...) method on the adapter as follows:
var adapter = new ETWLoggerAdapter();
var logger = adapter.GetLogger(typeof(MyClass));
logger.Warn("Message to Log here!"); 
  1. To Configure the logger via e.g., App.config, web.config files, add the relevant sections to your .config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <configSections>
    <sectionGroup name="common">
      <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
    </sectionGroup>
  </configSections>

  <common>
    <logging>
      <factoryAdapter type="Common.Logging.ETW.ETWLoggerFactoryAdapter, Common.Logging.ETWLogger">
      </factoryAdapter>
    </logging>
  </common>

</configuration>

Advanced Configuration

Common.Logging.ETWLogger offers several configuration options...

Clone this wiki locally