© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago
Brady Kelly

Configure Serilog to only write warnings to Seq sink

I have the following Serilog configuration:
        Serilog.Debugging.SelfLog.Enable(Console.Error);
        Log.Logger = new LoggerConfiguration()
            .Enrich.WithProperty("Application", typeof(Program).Assembly.GetName().Name)
            .MinimumLevel.Verbose()
            .MinimumLevel.Override("Microsoft.EntityFrameworkCore", Serilog.Events.LogEventLevel.Error)
            .WriteTo.Console().MinimumLevel.Information()
            .WriteTo.Seq("http://localhost:5341", apiKey:"awz1rXJhgYM2xxKKYaZ2")
            .WriteTo.EventLog(source:"Application", logName:"Application", restrictedToMinimumLevel:LogEventLevel.Warning) 
            .CreateLogger();
        Serilog.Debugging.SelfLog.Enable(Console.Error);
        Log.Logger = new LoggerConfiguration()
            .Enrich.WithProperty("Application", typeof(Program).Assembly.GetName().Name)
            .MinimumLevel.Verbose()
            .MinimumLevel.Override("Microsoft.EntityFrameworkCore", Serilog.Events.LogEventLevel.Error)
            .WriteTo.Console().MinimumLevel.Information()
            .WriteTo.Seq("http://localhost:5341", apiKey:"awz1rXJhgYM2xxKKYaZ2")
            .WriteTo.EventLog(source:"Application", logName:"Application", restrictedToMinimumLevel:LogEventLevel.Warning) 
            .CreateLogger();

In this case I've had to include the minimum level override for
Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore
because it was filling up the Windows Event Log sink with warnings I'd rather only see in Seq. Moving on I would like to 'reverse' this to only write EF Core warning level events (or other detailed events) to the Seq sink. How can I go about this?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Serilog.Settings.Configuration file sink not writing to file?
C#CC# / help
3y ago
✅ Serilog does not write logs to file
C#CC# / help
3y ago
❔ Serilog file sink from multiple servers has interleaved messages
C#CC# / help
3y ago
Serilog per sink and per log type loglevel override
C#CC# / help
4y ago