我有2个spring boot应用程序使用azure应用程序洞察。两者都使用相同的依赖项、相同的指令插入键、相同的应用程序属性。但在一个服务中,日志会进入应用程序洞察,而另一个服务不会打印日志。我使用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: tracelogback-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.发布于 2019-08-23 18:29:01
这里提到的旧版本存在一些已知的logback问题:
https://github.com/Microsoft/ApplicationInsights-Java/issues/453
请尝试使用最新的Application Insights Java SDK
https://github.com/Microsoft/ApplicationInsights-Java/releases
https://stackoverflow.com/questions/57327768
复制相似问题