I am developing a Spring Boot web application. I am trying to access an environment variable from Websphere server in my log4j2.xml configuration. But somehow it's not working.
Environment variable is set in WAS under the below path -
Application servers > server001 > Process definition > Java Virtual Machine > Custom properties
My log4j2.xml configuration is as follows -
<Appenders>
<RollingFile name="RollingFile"
fileName="$${env:environment}/apps/was/logs/app-logs.log"
filePattern="$${env:environment}/apps/was/logs/$${date:yyyy-MM}/app-logs-%d{-dd-MMMM-yyyy}-%i.log.gz">
<PatternLayout>
<pattern>%d %p %C{1.} [%t] %m%n</pattern>
</PatternLayout>
<Policies>
<OnStartupTriggeringPolicy />
<SizeBasedTriggeringPolicy
size="10 MB" />
<TimeBasedTriggeringPolicy />
</Policies>
</RollingFile>
</Appenders>
I have tried to get the environment variable using $${env:environment} / ${env:environment}/ ${environment}. Nothing is working working. It's not able to fetch the environment variable. So it's crating a folder named "${env:environment}" / ${environment} instead of "DVL".
From java I can able to access my environment variable without any issue -
System.getProperty("environment") ==> DVL
Please Help.