Azure functions Azure功能:使用Log4j2配置Slf4j绑定并将日志发送到appinsights

Azure functions Azure功能:使用Log4j2配置Slf4j绑定并将日志发送到appinsights,azure-functions,log4j2,slf4j,azure-application-insights,Azure Functions,Log4j2,Slf4j,Azure Application Insights,我正在使用Azure函数,需要使用带有log4j2的slf4j绑定执行日志记录。我希望我的日志存储在application insights(Azure monitor)中。为此,我有一个用于配置的log4j2.xml文件,我在其中添加了ApplicationInsights Appender,并为application insights资源设置插装键 当前的行为是,当我使用ExecutionContext.getLogger.info(“…”)时,我看到日志存储在app insights中,但

我正在使用Azure函数,需要使用带有log4j2的slf4j绑定执行日志记录。我希望我的日志存储在application insights(Azure monitor)中。为此,我有一个用于配置的log4j2.xml文件,我在其中添加了ApplicationInsights Appender,并为application insights资源设置插装键

当前的行为是,当我使用ExecutionContext.getLogger.info(“…”)时,我看到日志存储在app insights中,但这只使用java.util.logging。 然而,当我使用slf4j记录器进行日志记录时,日志不会存储在app insights中,我只能在控制台上看到它们


使用log4j2绑定配置slf4j以将日志发送到Azure函数中的app insights的正确方法是什么?这是可能的,还是azure函数只支持java.util.logging库来记录到appinsights?

azure函数的默认行为是使用java.util.logging库将日志发送到application insights。我没有在ApplicationInsights中看到slf4j日志的原因是我没有从pom.xml中排除其他日志库。 添加所有排除项后,slf4j-log4j2组合工作正常,我可以在我的application insights资源中查看日志