访问log4j2中的弹簧配置文件以进行弹簧引导应用程序

时间:2018-04-16 15:57:50

标签: spring spring-boot log4j2

如何访问log4j2中的$ {spring.profiles.active}值,以便我可以根据配置文件附加日志文件名?

log4j2.xml

{ "value": 0.13904124, "description": "function score, score mode [max]", "details": [ { "value": -0.6875923, "description": "function score, product of:", "details": [ { "value": 1, "description": "match filter: brand:brandy", "details": [] }, { "value": -0.6875923, "description": """ script score function, computed with script:"Script{type=inline, lang='painless', idOrCode='new java.util.Random().nextGaussian()', options={}, params={}}" and parameters: {} """, "details": [ { "value": 1, "description": "_score: ", "details": [ { "value": 1, "description": "id:[59974 TO 59974]", "details": [] } ] } ] } ] } ] },

1 个答案:

答案 0 :(得分:0)

我尝试使用以下配置并运行

<Property name="targetEnv">${sys:spring.profiles.active}</Property>

这可能有助于遇到同样问题的人