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

Andi Büchler updated LOG4J2-3132:
---------------------------------
    Description: 
I'm trying to figure out how to apply a BurstFilter to an Appender and limit 
the number of messages to 1 per / second and maxBurst to 1 via Java 
configuration but somehow the filter isn't applied and I get an error:

 
{noformat}
ERROR appender RollbarAppender has no parameter that matches element 
BurstFilter{noformat}
So what's the correct way to add filters? This is what I've got:
{code:java}
        @Bean
        public AppenderComponentBuilder rollbarAppender() {
                return configurationBuilder.newAppender("RollbarAppender", 
RollbarAppender.ROLLBAR_APPENDER_PLUGIN_NAME)
                        ..
                        .add(configurationBuilder.newFilter("BurstFilter", 
Filter.Result.NEUTRAL, Filter.Result.DENY)
                                .addAttribute("level", Level.ERROR) 
                                .addAttribute("rate", 0.016)
                                .addAttribute("maxBurst", 1));
        }
{code}

  was:
I'm trying to figure out how to apply a BurstFilter to an Appender and limit 
the number of messages to 1 per / second and maxBurst to 1 via Java 
configuration but somehow the filter isn't applied and I get an error:

 
{noformat}
ERROR appender RollbarAppender has no parameter that matches element 
BurstFilter{noformat}
So what's the correct way to add filters? This is what I've got:
{code:java}
        @Bean
        public AppenderComponentBuilder rollbarAppender() {
                return configurationBuilder.newAppender("RollbarAppender", 
RollbarAppender.ROLLBAR_APPENDER_PLUGIN_NAME)
                        ..
                        .add(configurationBuilder.newFilter("BurstFilter", 
Filter.Result.NEUTRAL, Filter.Result.DENY)
                                .addAttribute("level", Level.ERROR) 
                                .addAttribute("rate", "0.016")
                                .addAttribute("maxBurst", "1"));
        }
{code}


> Adding BurstFilter with Java configuration
> ------------------------------------------
>
>                 Key: LOG4J2-3132
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3132
>             Project: Log4j 2
>          Issue Type: Question
>          Components: Filters
>    Affects Versions: 2.14.1
>            Reporter: Andi Büchler
>            Priority: Major
>
> I'm trying to figure out how to apply a BurstFilter to an Appender and limit 
> the number of messages to 1 per / second and maxBurst to 1 via Java 
> configuration but somehow the filter isn't applied and I get an error:
>  
> {noformat}
> ERROR appender RollbarAppender has no parameter that matches element 
> BurstFilter{noformat}
> So what's the correct way to add filters? This is what I've got:
> {code:java}
>       @Bean
>       public AppenderComponentBuilder rollbarAppender() {
>               return configurationBuilder.newAppender("RollbarAppender", 
> RollbarAppender.ROLLBAR_APPENDER_PLUGIN_NAME)
>                       ..
>                       .add(configurationBuilder.newFilter("BurstFilter", 
> Filter.Result.NEUTRAL, Filter.Result.DENY)
>                               .addAttribute("level", Level.ERROR) 
>                               .addAttribute("rate", 0.016)
>                               .addAttribute("maxBurst", 1));
>       }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to