【问题标题】:Azure Application Insights console logs formatAzure Application Insights 控制台日志格式
【发布时间】:2020-01-10 07:54:57
【问题描述】:

我正在开发一个使用 azure Application Insights 的 spring-boot 应用程序。 我为控制台中显示的日志定义了格式,这些日志配置了 logback

<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
        <layout>
            <Pattern>%d{ISO8601} %level class=%C{1.} %X{requestKey} msg=%msg%n%throwable </Pattern>
        </layout>
</appender>

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

问题是AI在cosole中显示的日志如下:

2020-01-10 08:47:58,089 INFO class=org.springframework.boot.web.embedded.tomcat.TomcatWebServer  msg=Tomcat initialized with port(s): 8080 (http)
2020-01-10 08:47:58,802 INFO class=org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext  msg=Root WebApplicationContext: initialization completed in 8435 ms
AI: INFO 10-01-2020 07:48:00.819+0000, 1(main): Agent is not running

我不想以这种方式显示 AI: 日志,我的意思是,我想将此类跟踪格式更改为控制台附加程序中定义的相同格式:

2020-01-10 08:47:58,802 INFO class=com.microsoft.blabla.ApplicationInsights msg=Agent is not running

是否可以更改此类跟踪格式?

提前致谢

【问题讨论】:

    标签: azure spring-boot logging logback azure-application-insights


    【解决方案1】:

    您看到的格式是内部 AI 调试日志记录格式,例如

        AI: INFO 10-01-2020 07:48:00.819+0000, 1(main): Agent is not running
    

    目前无法更改此格式。

    但是,如果您想分享反馈,请在here 处提供有关您尝试实现的场景的更多详细信息,这将使产品团队能够相应地评估问题。谢谢

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-25
      • 1970-01-01
      • 1970-01-01
      • 2021-08-02
      • 1970-01-01
      • 2017-11-22
      • 1970-01-01
      • 2021-09-21
      相关资源
      最近更新 更多