Using the new Extensions.Logging package

I’ve been having some problems using the new Logging package combined with the Hosting package - check out the comments in the announcement:

Any ideas?

Hey @jbogard,

The NServiceBus.Extensions.Logging package has been designed for usages outside of the generic host, which manages logging itself. The main problem is the requirement for the LogManager to be configured before configuring the endpoint (due to all the statics used to capture the loggers) while the actual logger seems to be only accessible once the IServiceProvider has been built. The logging package does not solve that.

However, the current integration with the generic host logging is something which isn’t working very smoothly yet. We’re currently looking into the issue and we will most likely raise public issues about this very soon. Our generic host sample uses Simon Cropp’s [NServiceBus.MicrosoftLogging.Hosting] (NuGet Gallery | NServiceBus.MicrosoftLogging.Hosting 1.4.0) package which should solve all the current limitations. Have you had a chance to try that?

Yep that works great for me. Thanks @Simon_Cropp (and @SimonCropp ?)

Great to hear that this helps :+1:

FYI I raised this as an issue in the host repository so we can improve this on the next release: No built-in support integration with Microsoft.Extensions.Logging · Issue #46 · Particular/NServiceBus.Extensions.Hosting · GitHub

@jbogardactually most credit goes to @danielmarbach for that one

1 Like