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

String values with an unmatched right curly brace } drop the brace and subsequent characters #836

Open
philsttr opened this issue Jul 27, 2024 · 0 comments

Comments

@philsttr
Copy link

In logback xml, when configuring string values with an unmatched right curly brace, the right curly brace and everything after it is dropped.

An easy way to see this behavior is to configure the PatternLayoutEncoder's pattern as follows:

<configuration>
    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">

            <pattern>%m}This will not appear in the pattern</pattern>

        </encoder>
    </appender>

    <root>
        <appender-ref ref="console"/>
    </root>
</configuration>

And run the following class:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Main {
    private static Logger LOGGER = LoggerFactory.getLogger(Main.class);

    public static void main(String[] args) {
        LOGGER.info("Hello world!");
    }
}

The actual output will be:

Hello world!

The expected output is:

Hello world!}This will not appear in the pattern

This is a contrived example, but I chose it because it is very clear.

The actual use case was discovered here logfellow/logstash-logback-encoder#1009

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