Host Custom Logging

Component: NServiceBus Host
NuGet Package NServiceBus.Host (8-pre)
Target NServiceBus Version: 7.x
This page targets a pre-release version and is subject to change prior to the final release.

Code walk-through

This sample shows how to customize logging when running inside the NServiceBus host.

Configuring logging

public class EndpointConfig :
    IConfigureThisEndpoint
{
    public EndpointConfig()
    {
        var layout = new PatternLayout
        {
            ConversionPattern = "%d %-5p %c - %m%n"
        };
        layout.ActivateOptions();
        var appender = new ConsoleAppender
        {
            Layout = layout,
            Threshold = Level.Info
        };
        appender.ActivateOptions();

        BasicConfigurator.Configure(appender);

        LogManager.Use<Log4NetFactory>();
    }

Related Articles

  • Logging
    Manage and integrate with NServiceBus logging.

Last modified