I am using an Azure Function and I need to perform logging using slf4j binding with log4j2. I want my logs to get stored in application insights (Azure monitor). For this I have a log4j2.xml file for configuration, where I add the ApplicationInsights Appender and set the instrumentation key for the application insights resource.
Currently the behavior is that when I use ExecutionContext.getLogger.info("..."), I see the logs getting stored in app insights, but this uses java.util.logging only. However, when I use the slf4j logger for logging, the logs are not getting stored in app insights, I can only see them on console.
What is the correct way to configure slf4j with log4j2 binding for sending logs to app-insights in Azure Functions? Is that possible, or do azure functions only support java.util.logging library for logging to appinsights?