[
https://issues.apache.org/jira/browse/LOG4J2-1589?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dmitriy Neretin updated LOG4J2-1589:
------------------------------------
Affects Version/s: 2.7
> Value nesting during property substitution
> ------------------------------------------
>
> Key: LOG4J2-1589
> URL: https://issues.apache.org/jira/browse/LOG4J2-1589
> Project: Log4j 2
> Issue Type: Bug
> Components: Configurators
> Affects Versions: 2.5, 2.7
> Reporter: Dmitriy Neretin
> Priority: Minor
> Labels: features
>
> 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.
> For example:
> {code:xml}
> ...
> <Properties>
>
> <Property
> name="path">${sys:path.configured.by.provisioning:-${sys:com.sun.aas.instanceRoot}}/application/logfiles/application/logfiles</Property>
>
> </Properties>
> ...
> {code}
> 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!:
> ${sys:com.sun.aas.instanceRoot:-${sys:path.configured.by.provisioning}}
> So the default value will be properly substituted, but not the first
> property. The value of the first property is always: <dirname>}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]