如何在 log4j.properties 中使用系统环境变量? [英] How to use system environment variables in log4j.properties?

查看:108
本文介绍了如何在 log4j.properties 中使用系统环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了系统环境值PROJECT_HOME=C:Program FilesProject

I added the system environment value PROJECT_HOME=C:Program FilesProject

现在我正在尝试使用 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆