Host Custom Logging

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

Code walk-through

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

Configuring logging

public class EndpointConfig :
    IConfigureThisEndpoint,
    AsA_Server
{
    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