-
Notifications
You must be signed in to change notification settings - Fork 204
Common.Logging.ETWLogger
Steve Bohlen edited this page May 30, 2016
·
7 revisions
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.
- Add the
Common.Logging.ETWLogger
NuGet package to your project. - 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!");
- 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>
Common.Logging.ETWLogger
offers several configuration options...