A portable logging abstraction for .NET
C# Other
Failed to load latest commit information.
doc Fix typo in ConsoleOutLoggerFactoryAdapter declarative config example Oct 10, 2014
examples fixing error in example due to re-introduction of Common.Logging.Core Dec 24, 2014
lib log4net 1.2.15 Adapter Jan 5, 2016
nuget-graphics graphics updates Nov 1, 2014
package-nuget add explicit -Source param to mitigate breaking-change removal of 'de… May 29, 2016
packages First pass at adding Serilog. Jun 7, 2016
src prevent StackOverflow from inadvertent unlimited recursion in CommonL… Aug 15, 2016
test improving and refactoring tests; introduce support for (re)registrati… Jul 6, 2016
tools update NuGet.exe to 3.4.3 May 28, 2016
.gitignore remove Serilog1514 XML doc file output and add to IGNORE list Jun 18, 2016
Common.Logging.2010-net20.sln log4net 1.2.15 Adapter Jan 5, 2016
Common.Logging.2010-net20.sln.GhostDoc.xml GhostDoc settings Jun 4, 2015
Common.Logging.2010.sln basic string-based message logging generally functional May 25, 2016
Common.Logging.2010.sln.GhostDoc.xml adding GhostDoc config file Apr 22, 2016
Common.Logging.2013.sln rename projects, add to VS 2013 solution, adjust BUILD output dirs Jun 4, 2015
Common.Logging.2013.sln.GhostDoc.xml adding GhostDoc config files Jun 4, 2015
Common.Logging.2015.sln tweak build output pathing for DotNetCore projects Jul 2, 2016
Common.Logging.2015.sln.GhostDoc.xml adding GhostDoc config file Apr 22, 2016
Common.Logging.build use/find latest MSBUILD.exe to ensure that we're not building with ou… Jul 3, 2016
Common.Logging.ndoc fixing nant refs to correct ziplib binary for packaging step Jan 19, 2012
appveyor.yml wire up post-build script to post test-results to Appveyor dashboard Jan 11, 2015
build-ci.cmd Revert "setting ci build script to only compile as CI box will scan a… Jun 1, 2014
build-dev.cmd chain build*.cmd files to call thru to same build.cmd Jan 19, 2012
build-package.cmd chain build*.cmd files to call thru to same build.cmd Jan 19, 2012
build-release.cmd upd build script to reflect version 3.4-alpha1 release Jun 18, 2016
build.cmd chain build*.cmd files to call thru to same build.cmd Jan 19, 2012
changelog.txt adjust explanation of PCL support strategy in notes for 3.0.0 Mar 27, 2015
global.json update to .NET Core 1.0 RTM (despite the presence of "-preview-" in t… Jul 2, 2016
license.txt add top level readme and license file. Remove similar in subdirs Feb 27, 2007
readme.md minor tweaks Jun 18, 2016
release-checklist.txt fixed missing tools folder for release Apr 26, 2009


Common.Logging .NET

Project Build Status

Build status


Provides a simple logging abstraction to switch between different logging implementations. There is current support for log4net, NLog, Microsoft Enterprise Library logging, Microsoft Application Insights, Microsoft Event Tracing for Windows, and Serilog.

Additionally Common.Logging comes with a set of base classes making the integration of any log system a breeze.

See also

Console Quickstart

This demonstrates how to configure your app to log using the built in Common.Logging console adapter.

1) Install Common.Logging via NuGet

Either open the Package Management Console and enter the following or use the built-in GUI

NuGet: PM> Install-Package Common.Logging

2) Register and configure Common.Logging

Then add the relevant sections to your app.config or web.config:

<?xml version="1.0" encoding="utf-8" ?>

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

      <factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging">
        <arg key="level" value="INFO" />
        <arg key="showLogName" value="true" />
        <arg key="showDateTime" value="true" />
        <arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:fff" />


NLog Quickstart

There are different packages for each major NLog version. Install the correct package for your referenced NLog version. This example installs the adapter for NLog v2.0:

PM> Install-Package Common.Logging.NLog20

If you are using NLog v3.0, you should install the Common.Logging.NLog30 package and so on.

The app config should then have a common logging section like below. Be sure to match the factoryAdapter type with your installed Common.Logging.NLogXX version.

      <factoryAdapter type="Common.Logging.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog20">
        <arg key="configType" value="INLINE" />

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

Application Insights Quickstart

There are different packages for each major Application Insights version. Install the correct package for your referenced Application Insights version. This example installs the adapter for Application Insights v0.17:

PM> Install-Package Microsoft.ApplicationInsights -Version 0.17.0

The app config should then have an Application Insights section like below. Be sure to set the InstrumentationKey with your InstrumentationKey retrieved from Application Insights portal https://portal.azure.com.

      <factoryAdapter type="Common.Logging.ApplicationInsights.ApplicationInsightsLoggerFactoryAdapter, Common.Logging.ApplicationInsights">
        <arg key="InstrumentationKey" value="[YOUR APPLICATION INSIGHTS INSTRUMENTATION KEY]" />

See module documentation and Source Forge for other factoryAdapters and their configuration values

Solution Layout

  • bin contains the Common.Logging distribution dll files
  • doc contains reference documentation.
  • shared contains shared nant build scripts
  • modules contains the sourcecode for Common.Logging.XXXX modules
  • redist contains redistributable assemblies like log4net for your convenience

The Common Infrastructure Libraries for .NET are released under the terms of the Apache Software License (see license.txt).


  • Clone the GitHub repository
  • Install Silverlight SDK 5
  • [Optional] Install Java for the documentation builder
  • Create a strong name key. c:\netcommon>sn -k common.net.snk
  • Build the the solution. c:\netcommon>build-release.cmd