Reputation: 8906
We have recently encountered a problem: if external service fails, logs easily become flooded with similar data indicating a problem. In logback problem was solved easily: I've set log size threshold, after which log files were rolled over and zipped.
Is there a similar feature, when using log4j? I need to have a support for both daily rollover and size-threshold rollover.
Upvotes: 1
Views: 225
Reputation: 5101
Hava a look at RollingFileAppender. There is an example that you can base on. An appender for daily rolling is included. You can extend it if you need an additional size threshold, or use the TimeAndSizeRollingAppender from Simon Park.
Upvotes: 1