CommonLogging Usage

Component: CommonLogging
NuGet Package NServiceBus.CommonLogging (2.1)
Target NServiceBus Version: 5.x
Standard support for version 5.x of NServiceBus has expired. For more information see our Support Policy.


This sample shows a usage of CommonLogging as a logging framework for NServiceBus.

Enabling Logging

Common.Logging.LogManager.Adapter = new ConsoleOutLoggerFactoryAdapter
    Level = LogLevel.Info


var busConfiguration = new BusConfiguration();

Verifying that the sample works correctly

In this sample the information at the Info level is logged to the console window.

There will be a few standard logging entries in the console window that are automatically created by NServiceBus when logging level is set to Info, for example:

 Queue [private$\error] is running with [Everyone] and [NT AUTHORITY\ANONYMOUS LOGON] permissions. Consider setting appropriate permissions, if required by the organization. For more information, consult the documentation.

There will also be a custom entry logged from inside the handler Hello from MyHandler.

Related Articles

Last modified