Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
1.2.3, 1.3.0-alpha4
-
None
Description
As you requested in my PR I created an account and issue for this matter.
Short description from the pull request for searchability in JIRA:
Currently it's not possible to escape strings like ${some.property} in the logback.xml.
This is escpecially problematic when trying to use a replacement command with named groups in the appender pattern.
Therefore something like this will attempt to insert a property value instead of the named group:
%replace(%msg){'(?<namedGroup>somestuffhere)', '${namedGroup}'}
I kept this example as simple (stupid) as possible for demonstration purposes since real world patterns where you need named groups often are
pretty complex.
As stated in my solution (see PR) the implementation could be improved. Currently each of the characters $, {, : and } are affecting the token state even if the string doesn't represent a property reference, such as {test} or test:test. Maybe I'm missing something and the curly braces have a special meaning even without a preceding dollar sign, but otherwise the tokenizer could be more strict, so escaping would only need a single \ in front of the dollar sign (like \${escaped}) instead of every character (\$\{namedGroup\}).