如何读取log4j2.yml中的spring boot application.yml属性

问题描述 投票:0回答:1

我想从application.yml中读取日志路径,并且使用在log4j2.yml中这可能吗?如果是,如何?

示例:

application.yml

日志:路径:logs / app.log

log4j2.yml

RollingFile:-名称:LogToRollingFilefileName:$ {log.path}

path log4j2
1个回答
0
投票

使用Log4j 2.13.0或2.13.1。它包含一个log4j-spring-cloud-config-client jar。包括在您的应用程序中。完成后,您可以使用Spring Lookup在log4j2.xml中包含来自application.yml的属性。 Logging in the Cloud中的示例显示了如何使用Spring,Docker和Kubernetes查找。

© www.soinside.com 2019 - 2024. All rights reserved.