Difference between revisions of "Common Logging"

From Hiasobi - FHIR
Jump to: navigation, search
(Created page with "== Common Logging == Supported as follows: * Common.Logging.dll (v2.1.1.0) built in * External adapters e.g. NLog - Common.Logging.NLog20.dll * Configuration: <app>.exe.config...")
 
Line 5: Line 5:
 
* Configuration: <app>.exe.config - configure logging
 
* Configuration: <app>.exe.config - configure logging
 
* Defauly is no logging (null logger)
 
* Defauly is no logging (null logger)
 
 
==<app>.exe.config for NLog==
 
  
  
Line 15: Line 12:
 
* NLog.dll - NLog2 core library
 
* NLog.dll - NLog2 core library
 
* NLog.config - external configuration file for NLog; (may be done in-line in the <app>.exe.config)
 
* NLog.config - external configuration file for NLog; (may be done in-line in the <app>.exe.config)
 +
* <app>.exe.config
 +
<code>
 +
<?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.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog20">
 +
        <arg key="configType" value="FILE" />
 +
        <arg key="configFile" value="NLog.config" />
 +
      </factoryAdapter>
 +
    </logging>
 +
  </common>
 +
</configuration>
 +
</code>

Revision as of 11:00, 3 March 2014

Common Logging

Supported as follows:

  • Common.Logging.dll (v2.1.1.0) built in
  • External adapters e.g. NLog - Common.Logging.NLog20.dll
  • Configuration: <app>.exe.config - configure logging
  • Defauly is no logging (null logger)


NLog Configuration

Require libraries and configuration

  • Common.Logging.NLog20.dll - NLog2 common logging adapter
  • NLog.dll - NLog2 core library
  • NLog.config - external configuration file for NLog; (may be done in-line in the <app>.exe.config)
  • <app>.exe.config

<?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.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog20">
       <arg key="configType" value="FILE" />
       <arg key="configFile" value="NLog.config" />
     </factoryAdapter>
   </logging>
 </common>

</configuration>