[logback-dev] [JIRA] (LOGBACK-1446) Make property references escapable

QOS.CH (JIRA) noreply-jira at qos.ch
Sun Dec 9 17:01:00 CET 2018


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}'}}}.
 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 {{$}}, {{{}}, {{:}} 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}}}).



--
This message was sent by Atlassian JIRA
(v7.3.1#73012)


More information about the logback-dev mailing list