Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serilog MinimumLevel.Override

Tags:

serilog

My question is how granular do I need to be with Serilog MinimumLevel.Override when it comes to the source?

For example I want to have all messages from Microsoft be logged at the Warning Level.

Will the source "Microsoft" be adequate?

.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)

Or do I need to do something like this:

.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft.AspNetCore", LogEventLevel.Warning)
....
like image 590
user1337493 Avatar asked Oct 22 '25 10:10

user1337493


1 Answers

.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)

will cause all events from Microsoft, Microsoft.AspNetCore, Microsoft.AspNetCore.Hosting, etc., to be logged at the Warning level and above. It's not necessary to list every child namespace.

like image 125
Nicholas Blumhardt Avatar answered Oct 24 '25 05:10

Nicholas Blumhardt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!