Getting Started
Architecture
NServiceBus
Transports
Persistence
ServiceInsight
ServicePulse
ServiceControl
Monitoring
Samples

Host Custom Logging

Component: NServiceBus Host
NuGet Package: NServiceBus.Host (8.x)
Target Version: NServiceBus 7.x

Introduction

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