You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Dmitriy Neretin (JIRA)" <ji...@apache.org> on 2017/01/16 16:09:26 UTC

[jira] [Closed] (LOG4J2-1589) Value nesting during property substitution

     [ https://issues.apache.org/jira/browse/LOG4J2-1589?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitriy Neretin closed LOG4J2-1589.
-----------------------------------

Closed as duplicate.

> 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: StrSubstitutor, defaultVariable
>             Fix For: 2.8
>
>
> 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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org