Open drew-fc opened 8 months ago
I have been fighting with .NET Azure Function logging with Application Insights for six months (packages and default behavior have changed) and still not clear what is the correct way to see for example application logs in info but set EF Core logs to warning. How to setup app config code and host.json/appsettings.json (which is not part of the default template since even though it's needed for this?) sections correctly.
Could Azure Function team please solve this and add some actual documentation about this somewhere obvious (not hidden in GH issue comments)?
As a workaround, I managed to reduce the Information logs sent to TRACE of App Insights by adding the following environment variables in the Function App on Azure portal:
[ { "name": "AzureFunctionsJobHost:Logging:ApplicationInsights:LogLevel:Default", "value": "Warning", "slotSetting": false }, { "name": "AzureFunctionsJobHost:Logging:Console:LogLevel:Default", "value": "Warning", "slotSetting": false }, { "name": "AzureFunctionsJobHost:Logging:Debug:LogLevel:Default", "value": "Warning", "slotSetting": false }, { "name": "AzureFunctionsJobHost:Logging:LogLevel:Default", "value": "Warning", "slotSetting": false } ]
hi,
I have a .NET 8 Isolated function using v4. I am following this guide here to get AppInsights working and using the latest AppInsights from Nuget. My Program.cs looks nearly identical to this: https://github.com/devops-circle/Azure-Functions-Logging-Tests/blob/master/Func.Isolated.Net7.With.AI/Program.cs
In my function, I do something simple like this to test logging:
The logs show up in the Transaction search in Application insights, but they all show up as Trace entries, and the Severity level is always "Information"
Here is my apsettings.json:
And here is my Program.cs: