Search code examples
javalog4j2jvm-argumentswebsphere-liberty

liberty profile configuration issue (log4j2)


I can successfully set up log4j logging by setting up the following line within my jvm.options file:

-Dlog4j.configurationFile=C:/eclipse/runtime/usr/servers/tmpServer/log4j2.xml

However, I want to change this, so the path is not hard coded.

I was hoping this would work:

-Dlog4j.configurationFile=${server.config.dir}/log4j2.xml

But it does not. Any ideas why not?

I'm using liberty profile, and my log4j2.xml file is in the same directory as the jvm.options file.


Solution

  • Shell and variable expansion are not supported in jvm.options - check this page Customizing the Liberty profile environment - however server.config.dir is default working directory so setting: -Dlog4j.configurationFile=./log4j2.xml should work.