Search code examples
loggingjbosswildfly

Wildfly not allowing variable substitution in named-formatter


With latest Wildfly (version 18.0.0.Final), if I attempt to put a variable substitution for the named-formatter like this (in standalone.xml):

    <subsystem xmlns="urn:jboss:domain:logging:8.0">
        <console-handler name="CONSOLE">
            <level name="DEBUG"/>
            <formatter>
                <named-formatter name="${some.property:COLOR-PATTERN}"/>
            </formatter>
        </console-handler>

On start up, I get a FATAL error that looks like this:

ERROR [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0362: Capabilities required by resource '/subsystem=logging/console-handler=CONSOLE' are not available:
    org.wildfly.logging.formatter.${some.property:COLOR-PATTERN}; Possible registration points for this capability: 
        /subsystem=logging/pattern-formatter=*
        /subsystem=logging/custom-formatter=*
        /subsystem=logging/json-formatter=*
        /subsystem=logging/xml-formatter=*
        /subsystem=logging/logging-profile=*/pattern-formatter=*
        /subsystem=logging/logging-profile=*/custom-formatter=*
        /subsystem=logging/logging-profile=*/json-formatter=*
        /subsystem=logging/logging-profile=*/xml-formatter=*

I've filed a bug with jboss, but was wondering if anyone had run across this and had a good work-around. I really need this to be configurable, ie I can't use a literal name for named-formatter here.


Solution

  • Currently the named-formatter attribute does not allow expressions. This was an intentional decision as boot time logging would not support this. See WFCORE-157 for some reasons why.