Search code examples
springspring-bootazureazure-application-insights

Azure Application insights with Spring Boot Log issue


I have the azure spring boot service up and running, I have the configuration of Application insights in Azure. I have below code changes

pom.xml is as follows

    <dependency>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>applicationinsights-spring-boot-starter</artifactId>
        <version>2.6.4</version>
    </dependency>
    <dependency>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>applicationinsights-logging-logback</artifactId>
        <version>2.6.4</version>
    </dependency>
    <dependency>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>applicationinsights-core</artifactId>
        <version>2.6.4</version>
    </dependency>

and my logback-spring.xml is as follows.

<springProperty scope="context" name="INSTRUMENTATION_KEY"
    source="azure.application-insights.instrumentation-key"/>

  <appender name="aiAppender"
    class="com.microsoft.applicationinsights.logback.ApplicationInsightsAppender">
    <instrumentationKey>${INSTRUMENTATION_KEY}</instrumentationKey>
  </appender>

and my application.yml file as below,

azure:
  application-insights:
    instrumentation-key: <my_instrumentation_key>
    enabled: true
    web:
      enabled: true
    logger:
      level: info

This configuration is working fine and pushing the logs to Azure AI if I run my application locally. But when I push the same to Azure, I see none of the logs being pushed. Please help me on this since am banging my head for past 3 days.


Solution

  • This has been resolved after changing the version of applicationinsights-agent.jar to 3.2.4