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 "Ralph Goers (JIRA)" <ji...@apache.org> on 2014/03/01 00:12:20 UTC

[jira] [Commented] (LOG4J2-541) Allow all lookup types in DynamicThresholdFilter

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

Ralph Goers commented on LOG4J2-541:
------------------------------------

I tried implementing this but it makes the filter overly complicated.  If you can provide a reasonable patch I would consider it.

> Allow all lookup types in DynamicThresholdFilter
> ------------------------------------------------
>
>                 Key: LOG4J2-541
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-541
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Filters
>    Affects Versions: 2.0-rc1
>         Environment: Windows 7
> Java 6
>            Reporter: James Pretorius
>              Labels: features
>
> Currently the DynamicThresholdFilter only supports key values pairs in the ThreadContextMap. It would be good to see this expanded to include all log4j2 lookups. 
> In the below example the threshold level would be stored in a map value substituted at runtime.
> {code:javascript|title=log4j2.json snippet}
>  "root":{
>       "AppenderRef":{
>          "ref":"Console Appender",
>          "DynamicThresholdFilter":{
>             "defaultThreshold":"debug",
>             "key":"$${map:log.console.level}",
>             "onMatch":"ACCEPT",
>             "onMisMatch":"DENY",
>             "keyValuePair":[
>                {
>                   "key":"off",
>                   "value":"off"
>                },
>                {
>                   "key":"fatal",
>                   "value":"fatal"
>                },
>                {
>                   "key":"error",
>                   "value":"error"
>                },
>                {
>                   "key":"warn",
>                   "value":"warn"
>                },
>                {
>                   "key":"info",
>                   "value":"info"
>                },
>                {
>                   "key":"debug",
>                   "value":"debug"
>                },
>                {
>                   "key":"trace",
>                   "value":"trace"
>                }
>             ]
>          }
>       }
>    }
> {code}
> Alternatively, allow the threshold filter to be substituted with a runtime lookup value.
> {code:javascript|title=log4j2.json snippet}
>  "root":{
>       "AppenderRef":{
>          "ref":"Console Appender",
>          "ThresholdFilter":{
>             "level":"$${map:log.console.level}",
>             "onMatch":"ACCEPT",
>             "onMisMatch":"DENY"
>          }
>       }
>    }
> {code}
> The above will allow the developer to customise the log level at runtime across various loggers, appenders etc.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

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