logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitriy Neretin (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (LOG4J2-1243) Faulty placeholder substitution in config xml
Date Mon, 16 Jan 2017 16:06:26 GMT

    [ https://issues.apache.org/jira/browse/LOG4J2-1243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15824196#comment-15824196
] 

Dmitriy Neretin edited comment on LOG4J2-1243 at 1/16/17 4:06 PM:
------------------------------------------------------------------

Hi [~ralph.goers@dslextreme.com],

Sorry your fix didn't solve the problem. The problem itself was not the resolution of the
default value, but wrong string replacement in the StrSubstitutor line: 989 -> buf.replace(startPos,
endPos, varValue);

I used this test setup to test it: https://github.com/dimarzio/logging

If you set the property path.configured.by.provisioning to some directory the result will
be directory}

How I wrote in the LOG4J2-1589 if you set the enableSubstitutionInVariables to true it solves
the problem.


was (Author: dimarzio):
Hi [~ralph.goers@dslextreme.com],

Sorry your fix didn't solve the problem. The problem itself was not the resolution of the
default value, but wrong string replacement in the StrSubstitutor line: 989 -> buf.replace(startPos,
endPos, varValue);

I used this test setup to test it: https://github.com/dimarzio/logging

If you set the property path.configured.by.provisioning to some directory the result will
be directory}

> Faulty placeholder substitution in config xml
> ---------------------------------------------
>
>                 Key: LOG4J2-1243
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1243
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Lookups
>    Affects Versions: 2.5
>         Environment: JDK 8
>            Reporter: Veit Guna
>            Assignee: Ralph Goers
>             Fix For: 2.8
>
>
> I'm using log4j 2.5 in a REST service.
> There I would like to use the placeholder substitution to allow configuration of the
log location.
> I tried this:
> {code:xml}
> <Properties>
> <!-- sets the path for log4j logs:
> 1. check whether java system property myapp.logs is set. If not:
> 2. check whether the OS environment variable MYAPP_LOGS is set. If not:
> 3. use logs dir in the current directory
> -->
> <Property name="logsPath">${sys:mypapp.logs:-${env:MYAPP_LOGS:-logs}}</Property>
> </Properties>
> {code}
> This seems to work quite well with the exception, if myapp.logs is set, the path ends
with "}". So if I set the system property "-Dmyapp.logs=foobar" it creates the directory "foobar}"
and puts the logs into that. For the ENV substitution it works. It also works when NO placeholder
nesting is performed. So I guess the problem has something todo with that.
> See: http://mail-archives.apache.org/mod_mbox/logging-log4j-user/201601.mbox/%3CD91F2A5E-92AD-4A94-BA89-CCB7B5F83974%40gmail.com%3E
> Thanks
> Veit



--
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


Mime
View raw message