我不确定这是一个错误还是我尚未找到的一些晦涩的设置,但是对于相同的调用参数,我得到了不同的日志行为。我设置了一个脚本,使用相同的有效负载每 3 秒调用一次端点。在第一次通话时出现冷启动,我看到:
2020-03-05 22:04:13.262 Handler processing a request for: transform
2020-03-05 22:04:21.840 Handler processing a request for: transform
2020-03-05 22:04:21.840 Received message: Message(<snip>)
2020-03-05 22:04:21.841 Successful metrics: 1 Unsuccessful metrics: 0
2020-03-05 22:04:22.497 Function "transform" (Id: 98d6e618-637f-4104-81b5-a67f2701bb81) invoked by Java Worker
在随后的几个电话中,我只看到:
2020-03-05 22:04:24.216 Handler processing a request for: transform
2020-03-05 22:04:24.217 Function "transform" (Id: c1f4f7d0-b36e-4be4-bd38-aeebc5117900) invoked by Java Worker
这是我的host.json:
{
"version": "2.0",
"functionTimeout": "00:10:00",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0)"
},
"logging": {
"fileLoggingMode": "always",
"logLevel": {
"default": "Information",
"Host.Results": "Trace",
"Function": "Warning",
"Function.transform.User": "Information",
"Host.Aggregator": "Trace"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"maxTelemetryItemsPerSecond": 50
}
}
}
}
可能是什么问题呢?采样设置不影响行为。问题是诸如“收到的消息...”之类的消息是重要的消息。
我还查看了该功能的 kudu 应用程序转储,那里的日志记录也不完整。