【发布时间】: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