Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1082

logback.xml to logback.groovy translator fails to convert multi-line strings.

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 1.1.3
    • logback-classic
    • None

    Description

      Multi-line strings are converted using single quotes instead of triple-double-quotes.

      If you click on "View as .groovy" in the GEventEvaluator filter example then the resulting code is broken.

      evaluator(GEventEvaluator) {
            expression = 'e.level.toInt() >= WARN.toInt() && 
                 !(e.mdc?.get("req.userAgent") =~ /Googlebot|msnbot|Yahoo/ )'
          }
      

      Single- or double-quote strings in Groovy must not span multiple lines.

      I'd suggest to use something like this instead:

      evaluator(GEventEvaluator) {
            expression = """
            e.level.toInt() >= WARN.toInt() && 
                 !(e.mdc?.get("req.userAgent") =~ /Googlebot|msnbot|Yahoo/ )
            """
          }
      

      Attachments

        Activity

          People

            logback-dev Logback dev list
            jhuxhorn Joern Huxhorn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: