I added logging through opentelemetry and now I am getting duplicated entries of logs as they are sent through both Function's handler and opentelemetry handler.
I want to disable Function logging as opentelemetry adds tracer span awareness through OperationID/ParentID, thus making opentelemetry logs more functional with correlation. It is necessary to disable Function's logging in an individual function at this point, as the rest functions are not instrumented yet.
According to this document, I must be able to set environment variables like
AzureFunctionsJobHost__logging__logLevel__Function__MyFunction__User
to control logging while overriding other settings. I found that host-level setting like
AzureFunctionsJobHost__logging__logLevel__Function=None
does work, essentially disabling all logging, but on individual function level (with __MyFunction__User suffix) this setting is ignored.
I also noticed that settings through host.json work, too:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
},
"logLevel": {
"Function": "Information",
"Function.MyFunction.User": "None"
}
}
}
The above achieves the goal, but configuring through env vars is preferred for me. What am I missing?

