NServiceBus.NLog is obsolete. NServiceBus is now providing support for logging libraries through the Microsoft.Extensions.Logging. Please see Logging in .NET Core and ASP.NET Core for further details.
Usage
var config = new LoggingConfiguration();
var consoleTarget = new ColoredConsoleTarget
{
Layout = "${level}|${logger}|${message}${onexception:${newline}${exception:format=tostring}}"
};
config.AddTarget("console", consoleTarget);
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, consoleTarget));
LogManager.Configuration = config;
NServiceBus.Logging.LogManager.UseFactory(new ExtensionsLoggerFactory(new NLogLoggerFactory()));
Filtering
NServiceBus can write a significant amount of information to the log. To limit this information use the filtering features of the underlying logging framework.
For example to limit log output to a specific namespace.
Here is a code configuration example for adding a Rule.
var config = new LoggingConfiguration();
var target = new ColoredConsoleTarget();
config.AddTarget("console", target);
config.LoggingRules.Add(new LoggingRule("MyNamespace.*", LogLevel.Debug, target));
LogManager.Configuration = config;
NServiceBus.Logging.LogManager.UseFactory(new ExtensionsLoggerFactory(new NLogLoggerFactory()));