Overview

We've added support for the Common.Logging framework. This allows you to leverage your current investment in the Common.Logging framework, but leverage the power and flexibility that comes with the ReflectInsight viewer. You can view your Common.Logging messages in real-time, in a rich viewer that allows you to filter out and search for what really matters to you.

The Common.Logging extension supports Common.Logging v2.1.2. However if you need to support an older version, then you will need to download the ReflectInsight Logging Extensions Library from CodePlex. You can then reference and rebuild the extension against a specific release of the Common.Logging.dll that you plan to use. (Note: if you use the Nuget Package, the update to the latest version of the Common.Logging framework will be automatic).

Common.Logging Configuration

1. Download and install the ReflectInsight Viewer. You will need this installed to view your messages from the ReflectInsight Logging Extensions.

Download

2. Download the ReflectInsight Extension Binaries or Source and rebuild if necessary. Alternatively you can use the NuGet package. See below for details on the NuGet package.

NOTE: If you have added the Common.Logging Extension from the NuGet gallery, then you can skip step #3 as it's already done for you.

3. Once you have the ReflectInsight Extensions, go to your project in Visual Studio and add a reference to:
  • ReflectSoftware.Insight.dll
  • ReflectSoftware.Insight.Extensions.CommonLogging.dll.
CommonLogging_Adding_Assembly.png
4. The next step is to configure your app or web configuration file and incorporate the ReflectInsight extension needed by the Common.Logging framework. If you don't already have an App.config or Web.config, add it. Then open the configuration file and add a new ConfigSection as shown here:

<?xml version="1.0"?>
<configuration>
  <configSections>        
    <section name="insightSettings" type="ReflectSoftware.Insight.ConfigurationHandler,ReflectSoftware.Insight"/>
    <sectionGroup name="common">
      <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
    </sectionGroup>
  </configSections>
</configuration>
5. Now you will need to add the common section required for the Common.Logging framework, tell it what logging factor adapter to use. In our case, you would use the RIFactorAdapter as shown below:

<configuration>
   <common>
    <logging>
      <factoryAdapter type="ReflectSoftware.Insight.Extensions.CommonLogging.RIFactoryAdapter, ReflectSoftware.Insight.Extensions.CommonLogging">
        <arg key="configType" value="FILE" />
      </factoryAdapter>
    </logging>
  </common>
</configuration>
6. Now you will need to add the InsightSettings section. You can get started with the following simple configuration as shown below:

<configuration>
  <insightSettings>
    <baseSettings>
      <configChange enabled="true"/>      
      <propagateException enabled="false"/>      
      <exceptionEventTracker time="20"/>
      <debugMessageProcess enabled="true"/>
    </baseSettings>
 
    <listenerGroups active="Active">
      <group name="Active" enabled="true" maskIdentities="false">
        <destinations>
          <destination name="Viewer" enabled="true" filter="" details="Viewer"/>
        </destinations>
      </group>
    </listenerGroups>    
  </insightSettings>
</configuration>
7. Alternatively you can look at the configuration files that are part of the sample application.

8. That's it, you're done!

NuGet Package

We've created a NuGet package for our Common.Logging extension. You can find it over on Nuget.

To install ReflectSoftware.Insight.Extensions.CommonLogging extension, run the following command in the Package Manager Console.

sshot-548.png

Last edited Nov 21, 2013 at 4:09 PM by RSDeveloper, version 8