NopeCharon opened a new issue, #837: URL: https://github.com/apache/logging-log4cxx/issues/837
Log4cxx has no way to limit how many logging events an appender writes in a given period. When an error condition repeats in a tight loop (a lost connection retried continuously, a malformed input processed per record, a failing poll), the same message can be logged thousands of times per second. That fills the disk or the log shipping pipeline, slows the application down (each event is formatted and written, by default with a system call per event), and hides the earlier messages that explain the cause. The existing filters select events by level, logger, location, MDC or message text, so none of them can keep the first few occurrences while dropping the rest of a flood. The only way today is to wrap logging requests in application code. Log4j 2 provides this as its [`BurstFilter`](https://logging.apache.org/log4j/2.x/manual/filters.html#BurstFilter). Proposal: add a `log4cxx::filter::BurstFilter` with these options: | Option | Meaning | Default | | --- | --- | --- | | `Level` | Events at this level and less severe levels are rate limited. More severe events are never dropped. | `WARN` | | `Rate` | The average number of events per second passed on once a burst is used up. | `10` | | `MaxBurst` | The maximum number of events passed on in a burst. | 10 × `Rate` | It would be a token bucket that holds up to `MaxBurst` tokens and refills at `Rate` tokens per second, using a monotonic clock. A rate limited event uses one token. When no token is available, `decide()` returns `DENY`; otherwise it returns `NEUTRAL`, so the rest of the filter chain still runs. The class would be registered so it can be used from XML and properties configuration files: ```properties log4j.appender.A1.filter.1=BurstFilter log4j.appender.A1.filter.1.Level=WARN log4j.appender.A1.filter.1.Rate=16 log4j.appender.A1.filter.1.MaxBurst=100 ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
