How does one configure logging in Azure Functions ver 3?
The only way I managed to 'some what' configure logs is by having this in my Startup.cs (although I would like to have different configurations for local/development/production):
services.RemoveAll<IConfigureOptions<LoggerFilterOptions>>();
// don't show EF logs!!!
services.AddLogging(config => config.AddFilter("Microsoft", LogLevel.Error).AddFilter("System", LogLevel.Error));
Seems like this has no effect (local/development/other.settings.json):
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"MinerSchedule": "*/15 * * * *",
},
"Logging": {
"LogLevel": {
"Default": "Debug",
"Microsoft": "Error",
"System": "Error",
"Microsoft.Hosting.Lifetime": "Warning",
"Microsoft.EntityFrameworkCore.Database.Command": "Error"
}
},
I also tried modifying host.json (as some blogs have suggested) to no avail:
host.json
{
"version": "2.0",
"logging": {
"logLevel": {
"FirstKey.DataMiner.Functions": "Information"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
}
}
how can I configure logs so that I only see Information level from my Function app?