Custom Serilog configuration

Component: Serilog Logger | Nuget: NServiceBus.Serilog (Version: 2.x)
This is a community run project
Target NServiceBus Version: 5.x

Illustrates customizing logging usage by configuring Serilog targets and rules.

Configure Serilog

Edit
Log.Logger = new LoggerConfiguration()
    .WriteTo.ColoredConsole()
    .WriteTo.File("logFile.txt")
    .CreateLogger();

Pass that configuration to NServiceBus

Edit
LogManager.Use<SerilogFactory>();

var busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("Samples.Logging.SerilogCustom");

Related Articles

  • Logging
    Manage and integrate with NServiceBus logging.
  • Serilog Tracing
    Writing diagnostic log entries via Serilog Tracing.

Last modified