I've followed several tutorials online detailing how to send my Spring Boot application logs via logback to Azure Application Insights. When I run my code locally using the same command line as Azure App Service uses to start my app, I can see logs in Application Insights. However, when I deploy my app to Azure App Service, no logs are sent to Application Insights. So, my setup seems to be correct (logback.xml, library versions, etc.), but something is not quite right in Azure.
What am I missing?
Gradle:
implementation group: 'com.microsoft.azure', name: 'applicationinsights-spring-boot-starter', version: '2.6.1'
implementation group: 'com.microsoft.azure', name: 'applicationinsights-logging-logback', version: '2.6.1'
logback-spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<appender name="aiAppender" class="com.microsoft.applicationinsights.logback.ApplicationInsightsAppender">
<instrumentationKey>actual-key-value</instrumentationKey>
</appender>
<logger name="com.foobar" level="DEBUG"/>
<logger name="com.microsoft.applicationinsights" level="INFO"/>
<root level="INFO">
<appender-ref ref="aiAppender" />
</root>
</configuration>
command line
java -Dlogging.config=/home/site/wwwroot/logback-spring.xml -Dlogging.file=/home/LogFiles/bootlogback.log -jar /home/site/wwwroot/foobar-service-0.0.1-SNAPSHOT.jar"
(the deployment pulls out the logback-spring.xml from the jar and places it in the dir next to the jar file)
Again, running it locally with a similar command line (different directories to match my workstation), the logs are sent to Application Insights.