【发布时间】:2020-11-20 07:34:06
【问题描述】:
我想在 node js azure 函数中执行日志记录,日志应该出现在应用程序洞察中。
我尝试使用 sdk,并且还检查了应用程序洞察力>实时指标>示例遥测,但是我使用 context.log() 添加的自定义日志没有出现在应用程序地图内的任何地方,而不是事件。
那么我还能在哪里查看日志?任何人都可以给我任何我可以参考的例子吗?
【问题讨论】:
-
能否展示代码和相关设置文件?
-
const appInsights = require("applicationinsights"); appInsights.setup(config.APPINSIGHTS_INSTRUMENTATIONKEY) .setAutoCollectConsole(true, true) .setAutoCollectExceptions(true) .setAutoCollectPerformance(true, true) .start();常量客户端 = appInsights.defaultClient;在我的函数上方添加了这段代码
-
在 catch 块中我添加了 client.trackException({exception: new Error(err), tagOverrides:operationIdOverride}); context.log.error('Error===================>',err) 但是当我从邮递员和研究应用洞察>实时指标>示例遥测
标签: node.js logging azure-functions azure-web-app-service