Replies: 1 comment 1 reply
-
可以参考下 https://github.com/apolloconfig/apollo-use-cases/tree/master/spring-boot-logger |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
在apollo上配置了logging.config=classpath:log4j2-dev.xml发现没有生效,springboot启动的时候还是使用了默认的log4j2.xml作为日志配置
项目的log4j2.xml里面的console配置:
<Console name="console" target="SYSTEM_OUT"> <PatternLayout pattern="%d %t [%F:%L] %C %-5p : [%X{traceId}] %m%n" /> </Console>
项目的log4j2-dev.xml里面的console配置:
<Console name="console" target="SYSTEM_OUT"> <PatternLayout pattern="%d %t [%F:%L] %C %-5p : [%X{traceId},%X{spanId},%X{parentId},%X{exportable}] %m%n" /> </Console>
测试启动时候的console日志如下,没有读到log4j2-dev.xml:

加上apollo.bootstrap.eagerLoad.enabled=true后发现在打印springboot之前可以读取并使用log4j2-dev.xml,之后仍然使用log4j2.xml:

springboot版本:2.7.12
apollo版本:2.1.0
spring cloud版本:2021.0.7
Beta Was this translation helpful? Give feedback.
All reactions