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 "Matt Sicker (JIRA)" <ji...@apache.org> on 2016/11/16 19:01:58 UTC

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

    [ https://issues.apache.org/jira/browse/LOG4J2-1693?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15671299#comment-15671299 ] 

Matt Sicker commented on LOG4J2-1693:
-------------------------------------

I've tried reproducing this issue using ScriptFileFilterTest in log4j-core and can't get that error. Can you try reproducing this with the latest master branch?

> 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