How to use system environment variables in log4j.properties?

谁都会走 提交于 2019-12-17 18:38:15

问题


I added the system environment value PROJECT_HOME=C:\Program Files\Project

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**

Could you please tell me how to set system environment variables in log4j.properties?

Using log4j-1.2.7 version


回答1:


This is supported by EnvironmentLookup in log4j - 2. See examples.

Use ${sys:PROJECT_HOME} instead of ${env.PROJECT_HOME}



来源:https://stackoverflow.com/questions/22296275/how-to-use-system-environment-variables-in-log4j-properties

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!