This logging library makes large use of enterprise correlation.
In a lot of applications that incorporate various small and large services, it is often important to correlate events that happen across these services. It gives us a business workflow view of the various events that happen in the application, its components and services.
This library provide operation and activity ID management and propagation.

The main difference with this library over other is that you can configure each type of log separately. You can enable fatal, error, warning, debugging, informational, progress and sensitive data logging all independently of each other.
This is more flexible than the concept of minimum level logging, such as that in log4net or serilog e.g. enabling one warning in this libraries will enable error and fatal logging as well. This library allows you to set those settings independently of each other.

The SqlLogger maps AdditionalData to table columns, where the key of the dictionary entry is the column name and the value is serialised to JSON as the column value.
MetaData is serialised to a single JSON value stored in the MetaData column.
This means you can store data such as a User ID or Job ID in a separate column so you can filter more efficiently with indexes and partitions.

TraceLogger and ConsoleLogger both seralise and format all information into a single string.
The MultiLogger allows you to configure several different loggers to be used at once with different settings for each logger.

Usage is in the form of:
static void Main()
  ICorrelationIdHelper correlationIdHelper = new WebCorrelationIdHelper();
  // This value will be set automatically to all logs within this thread... so long as System.Threading.Tasks.Task.Factory.StartNew is used.

static void DoSyncWork()
  ILogger logger = new SqlLogger();
  logger.LogDebug("Some technical debugging details.");

static void DoAsyncWork()
  System.Threading.Tasks.Task.Factory.StartNew(() => {
    ILogger logger = new ConsoleLogger();
    logger.LogInfo("An informative message.");

This package installs cdmdotnet.Logging.dll with includes core logging functionality. Other packages depend on cdmdotnet.Logging for specific implementations.

Install-Package cdmdotnet.Logging -Version
dotnet add package cdmdotnet.Logging --version
<PackageReference Include="cdmdotnet.Logging" Version="" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add cdmdotnet.Logging --version
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: cdmdotnet.Logging,"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install cdmdotnet.Logging as a Cake Addin
#addin nuget:?package=cdmdotnet.Logging&version=

// Install cdmdotnet.Logging as a Cake Tool
#tool nuget:?package=cdmdotnet.Logging&version=
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes

Version 1.2.104

* Added support for IContainerLoggerSettings, an interface that allows container based settings at a very granular level.

Version 1.2.93

* Replaced a few usages of collections with better thread safe collections for much higher usage environments.

Version 1.2.92

* Added a null reference check to the configuration file base settings class to return a better error if there is an issue.

Version 1.2.91

* Added better support for serialisation issue with exceptions and meta-data - which are both considered secondary to trying to save all other information.

Version 1.2.88

* Added a sample SQL script for creating the logs table, see the tools folder.

Version 1.2.87

* Added the ability to turn off using performance counters. You may need to add a new property to your app.config or web.config "UsePerformanceCounters" with a boolean value.

Version 1.2.77

* Added optional properties to all telemetry methods.

Version 1.2.74

* Added Telemetry.

Version 1.2.65

* Refactored all loggers to use a simplified classes for more consistency.

Version 1.2.60

* Added MultiLogger.

Version 1.2.58

* Added the ability to specify the table to be used in the data so you can separate systems into different tables but have them all in the same DB
* Fixed poor handling of a missing connection string configuration.

Version 1.2.52

* Switched to using (and referencing) cdmdotnet.Statemanagement for controlling the passing of the CorrelationId from thread to thread safely when using Parallel Tasks.

Version 1.2.51

* Added Logger settings as a better default when using app.config and web.config files.

Version 1.1.49

* Replaced the threaded model with Parallel Tasks.

Version 1.1.48

* Resolved an issue where a NullReferenceException if AdditionalData was null.
* Added some documentation to explain how MetaData and AdditionalData is stored.

Version 1.1.46

* Remove cdmdotnet.Logging.Sql

Version 1.1.45

* Resolved an issue where a NullReferenceException could be raised during logging.
* Merged SqlLogger into cdmdotnet.Logging.

Version 1.1.39

* Added MetaData property
* Added AdditionalData property

NuGet packages (15)

Showing the top 5 NuGet packages that depend on cdmdotnet.Logging:

Package Downloads
Use MongoDB as the read store and data store in CQRS.NET
Use Azure Cosmos DB (DocumentDB) as an event store, read store and data store in CQRS.NET
Use Ninject as your IoC container of choice with Microsoft Azure DocumentDB for CQRS.NET
The built-in, Sql Store in the CQRS.NET cannot process non-primitive properties on the entity classes in read stores and data stores. If your entity classes require more comp[lexity than just basic, flat primitive property structures, this package will allow you to use Microsoft SqlServer as an read store and data store in CQRS.NET allowing you to build custom converters to provide mappings from your entities to you SQL table schema structures.
Use Akka.NET actors in CQRS.NET

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on cdmdotnet.Logging:

Repository Stars
A lightweight enterprise Function as a Service (FaaS) framework to write function based serverless and micro-service applications in hybrid multi-datacentre, on-premise and Azure environments.

Version History

Version Downloads Last updated 1,302 6/17/2018 586 6/17/2018 577 6/4/2018 553 6/4/2018 7,277 5/11/2018 599 5/11/2018 769 4/19/2018 831 3/29/2018 12,567 8/22/2017 14,152 5/30/2017 636 5/3/2017 1,815 4/18/2017 644 3/21/2017 619 3/21/2017 687 3/21/2017 693 3/19/2017 600 3/19/2017 626 3/14/2017 694 3/13/2017 652 3/7/2017 607 3/7/2017 581 3/6/2017 661 2/20/2017 583 2/14/2017 583 2/8/2017 584 1/23/2017 970 12/2/2016 612 12/2/2016 609 12/2/2016 644 12/2/2016 631 12/2/2016 848 12/2/2016 675 12/2/2016 681 11/28/2016 937 11/23/2016 604 11/22/2016 643 11/17/2016 778 11/1/2016 2,411 10/18/2016 937 5/23/2016 626 5/22/2016 620 5/20/2016 647 5/18/2016 566 5/16/2016 575 5/16/2016 36,053 9/23/2015 1,418 9/23/2015 13,076 9/9/2015 677 9/9/2015 629 9/9/2015 630 9/9/2015 612 9/9/2015 619 9/9/2015 605 9/9/2015 4,037 9/2/2015 651 9/2/2015 6,559 8/26/2015 2,106 8/26/2015 629 8/26/2015 10,306 5/27/2015 666 5/27/2015