You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Benjamin Jaton (JIRA)" <ji...@apache.org> on 2016/11/11 17:08:59 UTC

[jira] [Created] (LOG4J2-1693) Using a script prevents properties resolution

Benjamin Jaton created LOG4J2-1693:
--------------------------------------

             Summary: Using a script prevents properties resolution
                 Key: LOG4J2-1693
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1693
             Project: Log4j 2
          Issue Type: Bug
          Components: Layouts
    Affects Versions: 2.7
            Reporter: Benjamin Jaton


I am using the configuration below:

{code}{
  "configuration" : {
    "status" : "warn",
    "scripts": {
      "ScriptFile": { "name":"test.filter", "path": "/tmp/test.groovy" }
    },
    "properties" : {
      "property" : [ {
        "name" : "server.log.level",
        "value" : "INFO"
      } ]
    },
    "appenders" : {
      "appender" : [ {
        "type" : "Console",
        "name" : "STDOUT",
        "PatternLayout" : {
          "pattern" : "%m (Logger log level = ${server.log.level})%n"
        }
      } ]
    },
    "loggers" : {
      "root" : {
        "level" : "${server.log.level}",
        "AppenderRef" : {
          "ref" : "STDOUT"
        }
      }
    }
  }
}{code}

This is the output:
{code}2016-11-10 16:30:25,351 main WARN Error while converting string [${server.log.level}] to type [class org.apache.logging.log4j.Level]. Using default value [null].
test (Logger log level = ${server.log.level})
{code}

Somehow the properties resolution doesn't work.

If I remove the "scripts" block, then the everything works properly, and I see:
{code}test (Logger log level = INFO){code}

The script /tmp/test.groovy only contains "return true", it shouldn't really matter because it's not used anywhere.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org