Logging Incoming and Outgoing Messages to Rebus

158 Views Asked by At

I'm trying to get Rebus to log my ingoing and outgoing messages so I can track my operations across services.

As far as I can see I should already write that info to DEBUG, but nothing is showing up in my logs (Except startup info).

My stack is:

  • dotnet core worker service
  • Rebus
  • Azure Servicebus
  • Serilog
  • Application Insights

My configuration is as follows:

 Log.Logger = new LoggerConfiguration()
    .WriteTo.ApplicationInsights(telConfig, TelemetryConverter.Traces, LogEventLevel.Debug)
    .Enrich.WithRebusCorrelationId("CorrelationId")
    .CreateLogger();
Log.Logger.ForContext(LogEventLevel.Information, "Service", typeof(Program).Assembly.FullName);

services.AddRebus((configure, provider) => {
    return configure
        .Logging(l => l.Serilog())
    .Transport(t => t.UseAzureServiceBus(wc.RabbitMq, wc.InputQueueName))
    .Options(o => { o.SetNumberOfWorkers(5);})
    .Routing(r => r.TypeBased().MapAssemblyOf<CreateNewCustomerCommand>(wc.InputQueueName));
});

Edit I can see if I switch to colouredConsole that I'm actually missing ALL debug logs.

Maybe it's an issue with the Serilog integration

1

There are 1 best solutions below

0
Kenneth Jakobsen On

So I found out that this was because of how serilog works not rebus.

You have to set a global minimumlevel like MinimumLevel.Debug() to allow the sinks to go lower than that.