TimeAndSizeRollingAppender, a very handy Log4J appender that supports rolling log files by time and size. I haven’t found one that meet my requirements in the built-in/extra appenders provided by log4j project. DailyRollingFileAppender is the closest appender I could live with, but there is no way to control size of the file when rolling, which is very useful when triaging application issues at debug level trace.
TimeAndSizeRollingAppender appender is pretty cool, loving it so far. Compression is built-in and super easy to configure. It has many features and this comparison covers those in detail. Here is a sample log4j.properties file that I ended up using:
Possibly Related Posts:
- Local Variable Type Inference in Java 10
- Private interface methods in Java 9
- Java 8 gearing up for release, why Java 8 will be a top contender for Java.next languages in 2014?
- Configuring chunk size in Apache HttpClient 4.3.x
- Parallel Looping Constructs in Java (revisited)