There is already a good description what "default value nesting" is: http://logback.qos.ch/manual/configuration.html#nestedSubst
It is partially implemented in the log4j but it can still be improved.
The problem appears if your default value is a variable too.
Example: We have a glassfish project. Our log files must be placed to the <some_log_root>/application/logfiles directory on the server and if we work locally somewhere on our computer in the glassfish root <glassfish_root>/application/logfiles.
The <some_log_root> and <glassfish_root> will be set as a java system variables:
- <some_log_root>: -Dpath.configured.by.provisioning=/some/path/onserver/
- <glassfish_root>: -Dcom.sun.aas.instanceRoot=/glassfishroot/application/logfiles
At the moment we must have two log4j2.xml config files with different paths and it's not so great. So the target is to have only one config files that can handle thwo different paths.
If we deploy to the server and the value of path.configured.by.provisioning is the directory named 'master' the substitution result of StrSubstitutor is 'master}' then. But it works if we set this property as default value!:
So the default value will be properly substituted, but not the first property. The value of the first property is always: <dirname>}