I have an Azure Function written in Java that is accompanied with following host.json
file:
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.*, 4.0.0)"
},
"extensions": {
"http": {
"routePrefix": ""
},
"queues": {
"maxPollingInterval": "00:00:10"
}
},
"logging": {
"logLevel": {
"default": "Warning",
"Host": "Warning",
"Function": "Warning",
"Azure.Core": "Error"
}
}
}
In my understanding setting the "default": "Warning"
log level should result in producing very little logs, except for situations when something unusual happens. Unfortunately this does not seem to be the case. In Application Insights I can see tons of log entries like for example:
- "WorkerStatusRequest completed"
- "Worker initialized"
- "Worker terminate request received. Gracefully shutting down the worker."
- "Function "abc" (Id: defghijk) invoked by Java Worker"
- "Executed ‘Functions.abc’ (Succeeded, Id=defghijk, Duration=826ms)"
- "FunctionLoadRequest received by the Java worker, Java version – C:Program FilesJavamicrosoft-jdk-11.0.16.1 – 11.0.16.1"
- …
My question is how to make it silent. Those log statements are not so interesting for me. I have also observed that they are all logged with SeverityLevel=1
which according to the docs is equal to Debug
.
Thanks for any help.
2
Answers
Try making all possible options to false under Application insights
"Function": "Information", "Host.Aggregator":"Information",
"Host": "Error" },
"applicationInsights":
{
"enableDependency Tracking": false,
"excludedTypes": "Request; Dependency:"
Modify your host.json as shown below to reduce the excessive logging:
You can aso change all the log levels to Warning or Error.
Response:
As per doc, when the
SeverityLevel=1
, it refers toInformation
. So it displays all the function related information.