首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring boot应用程序不向Azure应用程序发送日志-洞察

Spring boot应用程序不向Azure应用程序发送日志-洞察
EN

Stack Overflow用户
提问于 2019-08-02 21:46:15
回答 1查看 1.5K关注 0票数 0

我有2个spring boot应用程序使用azure应用程序洞察。两者都使用相同的依赖项、相同的指令插入键、相同的应用程序属性。但在一个服务中,日志会进入应用程序洞察,而另一个服务不会打印日志。我使用azure门户检查了这一点。

我调试了启用日志记录器级别来跟踪,并在服务2中发现了以下错误日志,该服务没有将日志写入应用程序洞察。

第二个服务是将日志打印到控制台和滚动文件,但在azure门户中看不到日志。请建议为什么我会收到400错误,因为哪些日志没有发送到应用程序洞察

Build.gradle中的依赖项:

代码语言:javascript
复制
api "com.microsoft.azure:applicationinsights-spring-boot-starter:1.0.0-BETA"
api "com.microsoft.azure:applicationinsights-logging-logback:2.0.+"

Application.yaml中的属性:

代码语言:javascript
复制
azure:
  application-insights:
    instrumentation-key: instm-key
    enabled: true
    web:
      enabled: true
    logger:
      level: trace

logback-spring.xml:

代码语言:javascript
复制
    <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>

控制台日志:

代码语言:javascript
复制
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.
EN

回答 1

Stack Overflow用户

发布于 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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57327768

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档