Introduction
This project aims to provide lightweight 'infrastructure' libraries that can be used across multiple projects.
The first of these libraries is a portable logging abstraction, Common.Logging. Other libraries are planned but there is not a defined roadmap at the moment. Suggestions have ranged from a validation library to utilities for thread local storage. Your input is welcome! Either post a message to the mailing list on SourceForge or open an issue on GitHub
Common.Logging
NOTE: Common.Logging 2.1.1 was released on June 9, 2012 - grab your fresh copy as a NuGet package or directly from GitHub.
NOTE: The active source code Repository for Common.Logging is on GitHub here. Contributions should be made by forking the GitHub repository and issuing a pull request.
Overview
There are a variety of logging implementations for .NET currently in use, log4net, Enterprise Library Logging, NLog, to name the most popular. The downside of having differerent implementation is that they do not share a common interface and therefore impose a particular logging implementation on the users of your library.
Common.Logging library introduces a simple abstraction to allow you to select a specific logging implementation at runtime. Thus you can defer the decision what particular logging library to use until deployment. Adapters are used for plugging a particular logging system into Common.Logging.
The library is based on work done by the developers of IBatis.NET and it's usage is inspired by log4net. Many thanks to the developers of those projects! The library is available with both debug and strongly signed release assemblies.
What's new in 2.1?
- Full bi-directional event routing support for Entlib 3.1, EntLib 4.1, EntLib 5.0, log4net 1.2.9, log4net 1.2.10, log4net 1.2.11, NLog 1.0, and NLog 2.0 logging
- Leveraging lambdas, the ILog interface offers a & safe way to write log statements
log.Debug( m => m("value= {0}", obj.Value) );
This ensures, that the whole expression is only evaluated when
LogLevel.Debug is enabled and thus saves you from having to writeif (log.IsDebugEnabled) { log.Debug("value={0}", obj.Value); }
to avoid this overhead.
- Additional adapters to route log events from 3rd party libraries into the Common.Logging infrastructure
Upgrading
Common.Logging 2.1 is fully binary backwards compatible with 1.2. Please check the reference documentation for more information on upgrading
Getting started
To get started, grab the library from the downloads section, take a quick look at
the reference and API documentation, and code away!
^ TOP
Release Schedule
Features planned for the next release are
- Partial Trust compliance (already in the trunk)
- Support for Windows Azure
- Support for Silverlight
- Logging (aka 'Trace') Context support (in progress)
see System.Diagnostics.CorrelationManager and log4net contexts for examples
If you have any further ideas are specific needs, please submit them to as an issue to GitHub.
(Last updated 06/09/2012)