Hi i am trying to set the log4j.properties path under websphere custom properties as a relative path which is not working.
Setting Location:
Middleware servers > cluster1node1 > Process definition > Java Virtual Machine > Custom properties
This is working:
Property name: log4j.configuration
Value: file:/dir1/dir2/my_configs/log4j.properties
This is NOT working.
Property name: log4j.configuration
Value: ${CONFIG_ROOT}/my_configs/log4j.properties
Where config root is a websphere variable as below;
Name: CONFIG_ROOT
Value: /dir1/dir2/
Can someone tell me what possibly i am doing wrong here? I am able to use the similar relative path successfully for a normal application config file. Seems like this issue is applicable for just log4j.properties file.
LATEST UPDATE:
Actually the issue is more related to the filesytem as when i pre-fixed the relative path with file: it worked.
This is working now.
Property name: log4j.configuration
Value: file:${CONFIG_ROOT}/my_configs/log4j.properties
But why is that? Why it is not working without file: ? And how to make it work without file:
According to the log4j default initialization process explained in this answer, log4j attempts to convert the value of log4j.configuration into a URL, thus the need for file: