Serilog + NSB Logging breaks if you upgrade Serilog.Extensions.Hosting > 3.0.0

Greetings, all!

I’m writing to report an issue we just discovered in case it helps anyone else.
We’ve been using Serilog for logging our NSB projects for quite some time with .NET Core 3.1 with no issue and recently went to upgrade our templates from .NET Core 3.1 to .NET 5. As part of the upgrade we used a command line utility to upgrade to the latest versions of the dependencies. There weren’t any significant code changes with the upgrade aside from targeting the new framework, but we noticed all our NSB related logging disappeared (we were still getting logs from all the other parts of the template application).

After spending a couple hours of experimenting with library versions we isolated the issue to Serilog.Extensions.Hosting. If you upgrade past 3.0.0, no NSB logging. Revert to 3.0.0 --> it works again. We were able to fully upgrade all the other NSB and Serilog related libraries, it was just this one that we had to leave in the dark ages.

I’m not finding a lot of discussion about this on the webs so maybe not a lot of people have recently tried to implement NSB + Serilog from scratch with the latest libraries, but hopefully this info will help someone in future (or that the problem can be resolved, although that would likely require being able to see more of what’s actually happening inside NSB and where the failure actually occurs than I can from the compiled nuget packages).

Hope this helps!

FYI we use Serilog.Extensions.Hosting v4.1.2 and have no issue with missing log entries

Interesting, is that with .NET 5?
Would you be willing to share how you have Serilog & NSB configured so I can look for differences?
It’s possible there is some new extra step post 3.0.0 that is needed that I couldn’t find in docs.

yep net5

    var levelSwitch = new LoggingLevelSwitch(level);

    var configuration = new LoggerConfiguration();
    var enrich = configuration.Enrich;

    var destructuringOptionsBuilder = new DestructuringOptionsBuilder();
    if (destructurers != null)



    if (tenantId != null)
        enrich.WithProperty("TenantId", tenantId);

    var minimum = configuration.MinimumLevel;

        logger =>
                rollOnFileSizeLimit: true,
                fileSizeLimitBytes: 1000000, //1mb
                retainedFileCountLimit: 10,
                levelSwitch: levelSwitch,
                formatProvider: new CultureInfo("en-AU"));

    var seqUri = SeqUriConverter.GetSeqUri(seqUrl);
    if (seqUri != null)
            logger => { logger.WriteTo.Seq(seqUri, apiKey: apiKey, controlLevelSwitch: levelSwitch); });

    //added a console sink to assist developers in troubleshooting during development.
    if (Environment.UserInteractive)
            logger =>
                    formatProvider: new CultureInfo("en-AU"),
                    restrictedToMinimumLevel: LogEventLevel.Debug);
                logger.Filter.ByExcluding(x => x.MessageTemplate.Text.StartsWith("StartupDiagnostics"));

note we are also using NServiceBus.Serilog: