-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add logging exclusion rule from program.cs
- Loading branch information
avrob
committed
Aug 3, 2024
1 parent
1bf3750
commit d754750
Showing
4 changed files
with
23 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,27 @@ | ||
using Microsoft.Azure.Functions.Worker; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
|
||
|
||
var host = new HostBuilder() | ||
.ConfigureFunctionsWebApplication() | ||
.ConfigureServices(services => { | ||
services.AddApplicationInsightsTelemetryWorkerService(); | ||
services.ConfigureFunctionsApplicationInsights(); | ||
}) | ||
.ConfigureLogging(logging => | ||
{ | ||
logging.Services.Configure<LoggerFilterOptions>(logOpts => | ||
{ | ||
LoggerFilterRule defaultRule = logOpts.Rules.FirstOrDefault( | ||
rule => rule.ProviderName == "Microsoft.Extensions.Logging.ApplicationInsights.ApplicationInsightsLoggerProvider"); | ||
if (defaultRule is not null) | ||
{ | ||
logOpts.Rules.Remove(defaultRule); | ||
} | ||
}); | ||
}) | ||
.Build(); | ||
|
||
host.Run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters