Details
-
Bug
-
Resolution: Fixed
-
Major
-
1.1.3
-
None
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