-
Notifications
You must be signed in to change notification settings - Fork 6

Description
We have a asp.net core 3 web api which is listening to azure servicebus queues using Rebus. We have setup serilog according to the setup guides, but it seems that Rebus creates its own instance of ILogger instead of using the one we create in Program.cs.
We have tried getting the current instance from DI like below, but it does not seem to work.
var logger = services.BuildServiceProvider().GetService();
services.AddRebus((options, serviceProvider) => options
.Logging(l => l.Serilog(logger))
.Transport(t => t.UseAzureServiceBus(configuration["RebusConfig:AzureServiceBusConnectionString"], configuration["RebusConfig:Order:InputQueueName"]).AutomaticallyRenewPeekLock())
Is there someway to make sure Rebus uses the same serilog instance as the rest of the app?
The problem that this makes is that we have a Agent running on the server which injects traceid and such into the logcontext, which only works with logs outside of Rebus with this setup.