File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
src/dotnet8/logging/AzFuncUni.Logging Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1
1
using Microsoft . Azure . Functions . Worker ;
2
2
using Microsoft . Azure . Functions . Worker . Builder ;
3
+ using Microsoft . Extensions . Configuration ;
3
4
using Microsoft . Extensions . DependencyInjection ;
4
5
using Microsoft . Extensions . Hosting ;
5
6
using Microsoft . Extensions . Logging ;
8
9
9
10
builder . ConfigureFunctionsWebApplication ( ) ;
10
11
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
+
11
21
// Logging to Application Insights
12
22
13
23
builder . Services
24
34
{
25
35
options . Rules . Remove ( toRemove ) ;
26
36
}
27
- } ) ;
37
+ } )
38
+ ;
28
39
29
40
builder . Build ( ) . Run ( ) ;
Original file line number Diff line number Diff line change 3
3
"logging" : {
4
4
"applicationInsights" : {
5
5
"samplingSettings" : {
6
- "isEnabled" : true ,
6
+ "isEnabled" : false ,
7
7
"excludedTypes" : " Request"
8
8
},
9
9
"enableLiveMetrics" : true
Original file line number Diff line number Diff line change 3
3
"Values" : {
4
4
"AzureWebJobsStorage" : " UseDevelopmentStorage=true;" ,
5
5
"FUNCTIONS_WORKER_RUNTIME" : " dotnet-isolated" ,
6
- "APPINSIGHTS_INSTRUMENTATIONKEY" : " 00000000000000000000000000000000" ,
7
6
"APPLICATIONINSIGHTS_CONNECTION_STRING" : " InstrumentationKey=00000000000000000000000000000000;IngestionEndpoint=https://francecentral-1.in.applicationinsights.azure.com/;LiveEndpoint=https://region.livediagnostics.monitor.azure.com/;ApplicationId=00000000000000000000000000000000"
8
7
}
9
8
}
You can’t perform that action at this time.
0 commit comments