Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appender class substitution is not implemented - is there a reason? #736

Open
lure opened this issue Nov 23, 2023 · 0 comments
Open

Appender class substitution is not implemented - is there a reason? #736

lure opened this issue Nov 23, 2023 · 0 comments

Comments

@lure
Copy link

lure commented Nov 23, 2023

A short snippet

    <appender name="STDOUT" class="${APPENDER_CLASS:-ch.qos.logback.core.ConsoleAppender}">
        <layout class="${LAYOUT_CLASS:-some.custom.Layout}">
            <hostName>${HOSTNAME}</hostName>
        </layout>

In this example, the layout class may be specified via env variable, which is useful to switch between different receivers.
However, the APPENDER_CLASS will not be substituted, throwing an error:

Caused by: java.lang.ClassNotFoundException: ${APPENDER_CLASS:-ch.qos.logback.core.ConsoleAppender}

Is there any particular reason for this behaviour?
It is tempting to "fix" it by changing line #23 to

appenderModel.setClassName(interpretationContext(attributes.getValue(CLASS_ATTRIBUTE)));

However, it doesn't seem to be a correct fix, as SaxEventInterpretationContext interpretationContext seems to not be used at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant