Phil created Bug LOGBACK-1101
Issue Type: Bug Bug
Affects Versions: 1.1.3
Assignee: Logback dev list
Attachments: logback-substitution-bug.zip
Components: logback-core
Created: 17/Sep/15 7:22 AM
Description:

I have an appender that has a string property. I would like that property to be in a JSON string format.

However, due to a parsing logic error, logback's variable substitution logic for strings will remove the last right curly brace from the string. This prevents me from being able to use a JSON string property.

For example, if the logback.xml contains:

    <appender name="xxx" class="TestAppender">
        <testProperty>{"hello":{"world":"yay"}}</testProperty>
    </appender>

And the TestAppender class contains:

    public void setTestProperty(String testProperty) {
        //...
    }

I expect logback to pass the following string to the setTestProperty method:

{"hello":{"world":"yay"}}

However, logback incorrectly strips off the trailing right curly brace, and instead passes the following string

{"hello":{"world":"yay"}

I have attached a project that demonstrates the behavior.

To run the test, execute the following:

mvn clean package
java -cp target/substitution-test-1.0-SNAPSHOT.jar Main
Project: logback
Priority: Major Major
Reporter: Phil
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
logback-dev mailing list
logback-dev@qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-dev

Reply via email to