logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Veit Guna" <Veit.G...@gmx.de>
Subject Placeholder substitution in config xml
Date Mon, 04 Jan 2016 13:45:55 GMT
Hi.

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:

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

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 "-Depss.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.

Can somebody confirm seeing the same?

Thanks
Veit

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message