使用 Spring Cloud Functions 实现了 Azure Function App。在应用程序设置“APPINSIGHTS_INSTRUMENTATIONKEY”中配置的 App Insights 检测密钥: 。
我使用 lombok 注释 @Slf4j 来记录消息,但我无法在应用程序见解中看到它们。应用程序见解仅捕获使用 ExecutionContext 日志写入的日志。
任何人都可以给我一份参考如何使用 slf4j 在 App Insights 中记录消息。
如果您使用的是 AppInsights 2.x,则可以使用applicationinsights-logging-logback
or applicationinsights-logging-log4j2
启用日志记录的库。请阅读文档了解有关启用日志的更多信息。
<!-- Logback -->
<dependencies>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-logging-logback</artifactId>
<version>[2.0,)</version>
</dependency>
</dependencies>
<!-- Log4J 2.0 -->
<dependencies>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-logging-log4j2</artifactId>
<version>[2.0,)</version>
</dependency>
</dependencies>
如果您使用的是 AppInsights 3.x,您可以配置代理它将自动将日志导出到 App Insights。
还有一个Azure Functions 中的预览功能启用可从 Azure 门户启用的分布式跟踪。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)