For the complete documentation index, see llms.txt. This section of documentation is indexed by https://docs.particular.net/nservicebus/llms.txt. Here is the markdown version of this page. Markdown versions of documentation pages are available by appending .md to the page URL. Directory URLs use index.md.

Common.Logging

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

Logging integration into the host

When using NServiceBus 10.2 or later with the .NET Generic Host, use Microsoft.Extensions.Logging directly instead of Common.Logging. The bridge package is not required:

var builder = Host.CreateApplicationBuilder();

builder.Logging.AddConsole();

builder.Services.AddNServiceBusEndpoint(endpointConfiguration);

For more information, see Hosting with Microsoft.Extensions.Hosting.

The NServiceBus.CommonLogging package provides support for writing NServiceBus log entries to Common.Logging. Common.Logging provides a simple logging abstraction to switch between different logging implementations, similar to Microsoft.Extensions.Logging.

Usage

LogManager.Adapter = new ConsoleOutLoggerFactoryAdapter();
NServiceBus.Logging.LogManager.Use<CommonLoggingFactory>();