Neon created LOGBACK-1446:
-----------------------------

             Summary: Make property references escapable
                 Key: LOGBACK-1446
                 URL: https://jira.qos.ch/browse/LOGBACK-1446
             Project: logback
          Issue Type: Improvement
          Components: logback-core
    Affects Versions: 1.3.0-alpha4, 1.2.3
            Reporter: Neon
            Assignee: Logback dev list


As you requested in my 
[PR|https://github.com/qos-ch/logback/pull/445#issuecomment-445518600] I 
created an account and issue for this matter.
Short description from the pull request for searchability in JIRA:
{panel}
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&#125;'&#125;}}.
 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.
{panel}

As stated in my solution the implementation could be improved. Currently each 
of the characters {{$}}, {{&#123;}}, {{:}} and {{&#125;}} are affecting the 
token state even if the string doesn't represent a property reference, such as 
{{&#123;test&#125;}} 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 {{&#92;}} in front of the dollar sign (like {{&#92;${escaped&#125;}}).



--
This message was sent by Atlassian JIRA
(v7.3.1#73012)
_______________________________________________
logback-dev mailing list
logback-dev@qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-dev

Reply via email to