Azure Application Insights 与 Azure Functions。日志调试未显示

Azure Application Insights with Azure Function. Log Debug not showing up

我的 Azure 函数当前正在记录到 Application Insights。

虽然 logger.logInformation 行生成的日志显示在 Application Insights 上,但 logger.logDebug 行生成的日志未显示。

我听说有一种方法可以通过为应用程序洞察启用特定的日志记录级别来临时启用通过此行的日志记录。

有人可以帮助我实现这个目标或指导我获取一些文档吗?

谢谢:)

您正在寻找 host.json 中的 logLevel 设置(假定 Functions V2。对于 Functions V1,请查看 logger 设置。)Documentation for both here.

详细步骤如下:

1.Nav 到您的函数应用程序 kudu 控制台:https://your_function_name.scm.azurewebsites.net/DebugConsole

2.In kudu 控制台,导航到 host.json(D:\home\site\wwwroot),然后单击 host.json 的编辑按钮:

3.Modify host.json 如下,然后保存:

4.After 运行 你的函数应用,去application insights搜索,你会找到调试信息:

在代码中使用LogDebug:

在应用程序洞察中,检查调试消息:

5.For v1 函数,您应该按照@Kath 提到的那样使用 link 来修改 host.json.