Andi Büchler created LOG4J2-3132: ------------------------------------ Summary: 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
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) // Level of messages to be filtered. Anything at or below this level will be filtered out if maxBurst has been exceeded. .addAttribute("rate", "0.016") // The average number of events per second to allow. .addAttribute("maxBurst", "1")); // The maximum number of events that can occur before events are filtered for exceeding the average rate. The default is 10 times the rate. } {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)