serilog / serilog-extensions-logging

Serilog provider for Microsoft.Extensions.Logging
Apache License 2.0
309 stars 99 forks source link

Configure log level in appsettings.json? #125

Closed dasjestyr closed 5 years ago

dasjestyr commented 5 years ago

So I have signalR installed, and I my logsettings in appsettings.json are as follows:

"LogLevel": {
      "Default": "Information",
      "System": "Warning",
      "Microsoft": "Information"
    }

However, I'm getting spammed with VRB messages from signalR and it only goes away if I remove this serilog integration. Is there some other configuration step I'm missing?

dasjestyr commented 5 years ago

I just realized that I should be using Serilog.AspNetCore so I swapped out for that and have the same issue.

It looks like the SignalR team will be removing that spam, however I don't think that's the root of the problem. That log is being sent as a Trace which serilog is correctly outputting as Verbose. But if the minimum level is Information, then these shouldn't be getting through, so I'm not sure if I'm missing a configuration item somewhere.

Note: I did replace the "LogLevel" block with "Serilog" like so:

"Serilog": {
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Microsoft": "Information",
        "System": "Warning" 
      } 
    } 
  } 
nblumhardt commented 5 years ago

@dasjestyr thanks for the follow-up. Are the messages from SignalR correctly tagged with a Microsoft.* source context?

dasjestyr commented 5 years ago

I can't really tell. Do you know where I should look?

nblumhardt commented 5 years ago

Depends on where you're sending the events - if JSON, for example, they'll have a SourceContext property.

One other realisation - when you swapped to Serilog.AspNetCore, did you remove ConfigureLogging() and add UsingSerilog()? Otherwise these two package will behave the same way.

nblumhardt commented 5 years ago

Closing this one as stale, but please let us know if you need any help with it :-)

vlixplatform commented 3 years ago

Sure need help on this one!