Skip to content

Instantly share code, notes, and snippets.

@graywolfcorp
Created February 13, 2024 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graywolfcorp/78e9927b6204b49b7a5034c85c96a065 to your computer and use it in GitHub Desktop.
Save graywolfcorp/78e9927b6204b49b7a5034c85c96a065 to your computer and use it in GitHub Desktop.
SeriLog config to exclude null messages from misc webjob actions
Log.Logger = new LoggerConfiguration()
.Enrich.FromLogContext()
.MinimumLevel.Override("System.Net.Http.HttpClient", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft.Hosting.Lifetime", LogEventLevel.Warning)
.WriteTo.Logger(x => x
.Filter.ByExcluding("StartsWith(@m, 'The next 5 occurrences')")
.Filter.ByExcluding("StartsWith(@m, 'Executing ''Functions')")
.Filter.ByExcluding("StartsWith(@m, 'Executed ''Functions')")
.Filter.ByExcluding("StartsWith(@m, 'null')") //suppress null messages from webjobs internal actions at INFO level https://github.com/Azure/azure-webjobs-sdk/issues/1968
.MinimumLevel.Information()
.WriteTo.Console())
.CreateLogger();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment