question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WriteTo.Seq(..) doesn't respect MinimumLevel.Override

See original GitHub issue

I’m configuring Serilog with Seq like that:

hostBuilder.UseSerilog((builder, loggerConfiguration) =>
            {
                var env = builder.HostingEnvironment;
                var seqConfig = builder.Configuration.GetSection("Seq");

                var loggingLevelSwitch = new LoggingLevelSwitch();

                loggerConfiguration.MinimumLevel.ControlledBy(loggingLevelSwitch)
                                   .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
                                   .MinimumLevel.Override("BeatPulse", LogEventLevel.Warning)
                                   .Enrich.FromLogContext()
                                   .Enrich.WithMachineName()
                                   .Enrich.WithEnvironmentUserName()
                                   .Enrich.WithProperty("Environment", env.EnvironmentName)
                                   .WriteTo.Console()
                                   .WriteTo.Seq(url ?? seqConfig["Url"], apiKey: apiKey ?? seqConfig["ApiKey"], controlLevelSwitch: loggingLevelSwitch);
            });

The console sink respects the override and doesn’t prompt messages from Microsoft and BeatPulse. Unfortunately the Seq-Sink does not.

I’m not sure if it’s a wrong config or it isn’t supported yet?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
stephanprobstcommented, Oct 10, 2018

Hey @nblumhardt ! I finally found it. We had multiple clients which logged to the same seq instance (which wasn’t intended in this case). It resulted in a view where you could think that the logging doesn’t work. Infact I looked at messages from a different client. So I have to apologize. It was all my fault. Many thanks for your help and work!

0reactions
nblumhardtcommented, Oct 11, 2018

Awesome, glad it turned out to be something simple 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

WriteTo.Seq(..) doesn't respect MinimumLevel.Override #115
I'm configuring Serilog with Seq like that: hostBuilder.UseSerilog((builder, loggerConfiguration) => { var env = builder.
Read more >
Overriding MinimumLevel doesn't work in Serilog
1 Answer. You are overriding the MinimumLevel only for log messages sent from a SourceContext with the name LogTest , as per your...
Read more >
Serilog 2.1 MinimumLevel.Override()
The Serilog MinimumLevel setting determines at which level log events are generated:
Read more >
flx/serilog
Override() runtime optimizations (@skomis-mm) ... #1472 - improve handling of minimum level overrides in sub-loggers (@skomis-mm) ... Sink(sink) / WriteTo.
Read more >
Reducing log verbosity with Serilog RequestLogging
In this post I describe how you can use Serilog.AspNetCore to reduce the number of logs generated by every request in ASP.NET Core...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found