如何在log4j.properties中使用系统环境变量? [英] How to use system environment variables in log4j.properties?
本文介绍了如何在log4j.properties中使用系统环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我添加了系统环境值
PROJECT_HOME = C:\Program Files\Project
I added the system environment value PROJECT_HOME=C:\Program Files\Project
现在我试图使用系统环境值在log4j.properties中,但没有设置它
Now i'm trying to use the system environment value in log4j.properties but didn't set it
**log4j.properties**
**log4j.appender.LOGFILE.File="${env.PROJECT_HOME}"/project.log**
你能请告诉我如何在log4j.properties中设置系统环境变量?
Could you please tell me how to set system environment variables in log4j.properties?
使用log4j-1.2.7版本
推荐答案
这是支持 EnvironmentLookup in log4j - 2.查看示例。
This is supported by EnvironmentLookup in log4j - 2. See examples.
使用 $ {sys:PROJECT_HOME}
而不是 $ {env.PROJECT_HOME}
这篇关于如何在log4j.properties中使用系统环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文