Spring Boot应用程序未将日志发送到Azure应用程序见解

时间:2019-08-02 13:46:15

标签: azure spring-boot azure-application-insights azure-application-insights-profiler

我正在使用azure应用程序见解提供2个spring boot应用程序。两者都使用相同的依赖项,相同的检测键,相同的应用程序属性。 但是在一项服务中,日志获取了应用程序的见解,而另一项服务则没有打印日志。我使用azure门户网站对此进行了检查。

我调试了启用记录程序级别的跟踪功能,并在服务2中发现了以下错误日志,该错误日志未将日志写入应用程序见解。

第二项服务是将日志打印到控制台并滚动文件,但是在azure门户中看不到日志。请提出为什么我会因为以下原因而出现400错误 哪些日志没有发送给应用程序见解

build.gradle中的依赖项:

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

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>

控制台日志:

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 个答案:

答案 0 :(得分:0)

这里提到了一些较早版本的已知logback问题:

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

请尝试使用最新的Application Insights Java SDK

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