[ 
https://issues.apache.org/jira/browse/LOG4J2-541?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

James Pretorius updated LOG4J2-541:
-----------------------------------

    Description: 
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.

  was:
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}



> 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-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to