Skip to content

Commit 703b12c

Browse files
committed
[src] adjust code
1 parent ad774fc commit 703b12c

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/dotnet8/logging/AzFuncUni.Logging/Program.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Microsoft.Azure.Functions.Worker;
22
using Microsoft.Azure.Functions.Worker.Builder;
3+
using Microsoft.Extensions.Configuration;
34
using Microsoft.Extensions.DependencyInjection;
45
using Microsoft.Extensions.Hosting;
56
using Microsoft.Extensions.Logging;
@@ -8,6 +9,15 @@
89

910
builder.ConfigureFunctionsWebApplication();
1011

12+
// Reading and configuring log levels and categories
13+
14+
var hostJsonLoggingSection = new ConfigurationBuilder()
15+
.AddJsonFile("host.json")
16+
.Build()
17+
.GetSection("logging");
18+
19+
builder.Logging.AddConfiguration(hostJsonLoggingSection);
20+
1121
// Logging to Application Insights
1222

1323
builder.Services
@@ -24,6 +34,7 @@
2434
{
2535
options.Rules.Remove(toRemove);
2636
}
27-
});
37+
})
38+
;
2839

2940
builder.Build().Run();

src/dotnet8/logging/AzFuncUni.Logging/host.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"logging": {
44
"applicationInsights": {
55
"samplingSettings": {
6-
"isEnabled": true,
6+
"isEnabled": false,
77
"excludedTypes": "Request"
88
},
99
"enableLiveMetrics": true

src/dotnet8/logging/AzFuncUni.Logging/local.settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"Values": {
44
"AzureWebJobsStorage": "UseDevelopmentStorage=true;",
55
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
6-
"APPINSIGHTS_INSTRUMENTATIONKEY": "00000000000000000000000000000000",
76
"APPLICATIONINSIGHTS_CONNECTION_STRING": "InstrumentationKey=00000000000000000000000000000000;IngestionEndpoint=https://francecentral-1.in.applicationinsights.azure.com/;LiveEndpoint=https://region.livediagnostics.monitor.azure.com/;ApplicationId=00000000000000000000000000000000"
87
}
98
}

0 commit comments

Comments
 (0)