0
votes

I am having 2 spring boot applications using azure application insights. Both are using the same dependencies, same instrumentation-key, same application-properties. But in one service the logs are getting to application insights and the other service is not printing logs. I checked this using azure portal.

I debugged enabling logger level to trace and found the following error logs in service 2 which is not writing logs to application-insights.

The 2nd service is printing logs to console and rolling file but the logs are not seen in azure portal. Please suggest why am I getting 400 error because of which logs are not getting sent to application-insights

dependencies in build.gradle:

api "com.microsoft.azure:applicationinsights-spring-boot-starter:1.0.0-BETA"
api "com.microsoft.azure:applicationinsights-logging-logback:2.0.+"

properties in application.yaml:

azure:
  application-insights:
    instrumentation-key: instm-key
    enabled: true
    web:
      enabled: true
    logger:
      level: trace

logback-spring.xml:

    <appender name="aiAppender"
        class="com.microsoft.applicationinsights.logback.ApplicationInsightsAppender">
    </appender> 

    <root level="ERROR">
        <appender-ref ref="CONSOLE" />
        <appender-ref ref="ROLLINGFILE" />
      <appender-ref ref="aiAppender" /> 
    </root>

console logs:

AI: TRACE 02-08-2019 18:54:53.208, 26(localhost-startStop-1): Registering PC 'DeadLockDetector'
AI: TRACE 02-08-2019 18:54:53.208, 26(localhost-startStop-1): Failed to store performance counter 'DeadLockDetector', since there is already one
AI: TRACE 02-08-2019 18:54:53.208, 26(localhost-startStop-1): Registering PC 'JvmHeapMemoryUsedPerformanceCounter'
AI: TRACE 02-08-2019 18:54:53.208, 26(localhost-startStop-1): Failed to store performance counter 'JvmHeapMemoryUsedPerformanceCounter', since there is already one
AI: ERROR 02-08-2019 18:54:53.211, 26(localhost-startStop-1): Failed to create WindowsPerformanceCounterAsPC: 'java.lang.Exception: Failed to register all built-in Windows performance counters.'
AI: TRACE 02-08-2019 18:54:53.211, 26(localhost-startStop-1): Registering PC 'JSDK_ProcessMemoryPerformanceCounter'
AI: TRACE 02-08-2019 18:54:53.211, 26(localhost-startStop-1): Failed to store performance counter 'JSDK_ProcessMemoryPerformanceCounter', since there is already one
AI: TRACE 02-08-2019 18:54:53.211, 26(localhost-startStop-1): Registering PC 'JSDK_ProcessCpuPerformanceCounter'
AI: TRACE 02-08-2019 18:54:53.211, 26(localhost-startStop-1): Failed to store performance counter 'JSDK_ProcessCpuPerformanceCounter', since there is already one
AI: ERROR 02-08-2019 18:54:53.211, 26(localhost-startStop-1): Failed to create WindowsPerformanceCounterAsPC: 'java.lang.Exception: Failed to register all built-in Windows performance counters.'
AI: TRACE 02-08-2019 18:54:53.211, 26(localhost-startStop-1): Registering PC 'JSDK_ProcessMemoryPerformanceCounter'
AI: TRACE 02-08-2019 18:54:53.211, 26(localhost-startStop-1): Failed to store performance counter 'JSDK_ProcessMemoryPerformanceCounter', since there is already one
AI: TRACE 02-08-2019 18:54:53.211, 26(localhost-startStop-1): Registering PC 'JSDK_ProcessCpuPerformanceCounter'
AI: TRACE 02-08-2019 18:54:53.211, 26(localhost-startStop-1): Failed to store performance counter 'JSDK_ProcessCpuPerformanceCounter', since there is already one
AI: TRACE 02-08-2019 18:54:53.211, 26(localhost-startStop-1): Registering PC 'DeadLockDetector'
AI: TRACE 02-08-2019 18:54:53.211, 26(localhost-startStop-1): Failed to store performance counter 'DeadLockDetector', since there is already one
AI: TRACE 02-08-2019 18:54:53.211, 26(localhost-startStop-1): Registering PC 'JvmHeapMemoryUsedPerformanceCounter'
AI: TRACE 02-08-2019 18:54:53.211, 26(localhost-startStop-1): Failed to store performance counter 'JvmHeapMemoryUsedPerformanceCounter', since there is already one
AI: INFO 02-08-2019 18:54:54.510, 26(localhost-startStop-1): Agent was not found. Skipping the agent registration
AI: TRACE 02-08-2019 18:54:55.895, 37(ActiveTransmissionNetworkOutput_1-0): Http response code 400 not handled by com.microsoft.applicationinsights.internal.channel.common.ErrorHandler
AI: TRACE 02-08-2019 18:54:55.895, 37(ActiveTransmissionNetworkOutput_1-0): Http response code 400 not handled by com.microsoft.applicationinsights.internal.channel.common.PartialSuccessHandler
AI: TRACE 02-08-2019 18:54:55.907, 37(ActiveTransmissionNetworkOutput_1-0): Http response code 400 not handled by com.microsoft.applicationinsights.internal.channel.common.ThrottlingHandler.
AI: TRACE 02-08-2019 18:55:03.161, 41(ActiveTransmissionNetworkOutput_1-1): Http response code 400 not handled by com.microsoft.applicationinsights.internal.channel.common.ErrorHandler
AI: TRACE 02-08-2019 18:55:03.161, 41(ActiveTransmissionNetworkOutput_1-1): Http response code 400 not handled by com.microsoft.applicationinsights.internal.channel.common.PartialSuccessHandler
AI: TRACE 02-08-2019 18:55:03.161, 41(ActiveTransmissionNetworkOutput_1-1): Http response code 400 not handled by com.microsoft.applicationinsights.internal.channel.common.ThrottlingHandler.
1

1 Answers

0
votes

There are some known logback issues with older versions which are mentioned here:

https://github.com/Microsoft/ApplicationInsights-Java/issues/453

Please try with latest Application Insights Java SDK

https://github.com/Microsoft/ApplicationInsights-Java/releases