'Log4J2 Nested Property Substitution

I am attempting to use Log4J2 property substitution to simplify my deployed log4j2.xml file. I want to share it between three deployed WAR files, so I've defined a system property detailing the external location of that file.

Now I've run into a different issue. I've added the following to my web.xml:

    <context-param>
        <param-name>loggingPrefix</param-name>
        <param-value>app1</param-value>
    </context-param>

In the log4j2.xml, I've created the following:

        <Console name="CONSOLE_LOG" target="SYSTEM_OUT">
            <PatternLayout pattern="$upper{${web:loggingPrefix}}> %d{dd MMM HH:mm:ss} %5p [%t] (%F:%L) - %m%n" />
        </Console>

What happens is that the loggingPrefix is properly output, but the log entry only prints out as $upper{app1}. I have also attempted to specify the $upper as $$upper.

Have I simply made a dumb mistake in the pattern?

(Note: I can't just put the uppercase in the web.xml, I need the lowercase value when I start implementing the RollingFileAppender entries.)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source