log4j2查找websphere环境变量
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了log4j2查找websphere环境变量相关的知识,希望对你有一定的参考价值。
我正在使用log4j2(版本2.10.0)和IBM Websphere 8.5.5.12。 问题是我的log4j2.properties中的Websphere环境变量没有得到解决。我尝试了一些类似的东西
property.filename = $${sys:Test}/Test.log
property.filename = ${env:Test}/Test.log
但无论我尝试什么,它都没有解决“测试”。谁可以帮我这个?
答案
如果您在JVM可访问的适当资源范围内创建了变量,则可以通过添加与Websphere环境变量和值相同的JVM自定义属性来修复此问题,如下所示:
Steps : In WAS Admin console, Go to
WebSphere application servers >
Server_name >
Java and Process Management (under Server Infrastructure)>
Process definition >
Java Virtual Machine (under Additional Properties)>
Custom properties
Click on New and enter below details :
Name : Test
Value : ${Test}
Apply and save the changes.
重启JVM并重新测试!
编辑:如下面的评论中所述,在添加JVM自定义属性后,可以从log4j文件直接访问该变量,如下所示:
property.filename = ${Test}/Test.log
以上是关于log4j2查找websphere环境变量的主要内容,如果未能解决你的问题,请参考以下文章
npm : 无法加载文件 D:softcodeProcess ode ode_global pm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.micr +(代码片段