我正在开发一个使用 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
是否可以更改此类跟踪格式?
提前致谢
最佳答案
您看到的格式是内部 AI 调试日志记录格式,例如
AI: INFO 10-01-2020 07:48:00.819+0000, 1(main): Agent is not running
目前无法更改此格式。
但是,如果您想分享反馈,请这样做 here有关您想要实现的场景的更多详细信息,这将使产品团队能够相应地评估要求。谢谢
关于Azure Application Insights 控制台日志格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59677454/