CompositeRollingAppender combines RollingFileAppender and DailyRollingFileAppender
It can function as either or do both at the same time (making size based rolling files like RollingFileAppender until a data/time boundary is crossed at which time it rolls all of those files as per the DailyRollingFileAppender) based on the setting for rollingStyle.
To use CompositeRollingAppender to roll log files as they reach a certain size (like RollingFileAppender), set rollingStyle=1 (@see config.size)
To use CompositeRollingAppender to roll log files at certain time intervals (daily for example), set rollingStyle=2 and a datePattern (@see config.time)
To have CompositeRollingAppender roll log files at a certain size AND rename those according to time intervals, set rollingStyle=3 (@see config.composite)
A of few additional optional features have been added:
-- Attach date pattern for current log file (@see staticLogFileName)
-- Backup number increments for newer files (@see countDirection)
-- Infinite number of backups by file size (@see maxSizeRollBackups)
A few notes and warnings: For large or infinite number of backups countDirection > 0 is highly recommended, with staticLogFileName = false if time based rolling is also used -- this will reduce the number of file renamings to few or none. Changing staticLogFileName or countDirection without clearing the directory could have nasty side effects. If Date/Time based rolling is enabled, CompositeRollingAppender will attempt to roll existing files in the directory without a date/time tag based on the last modified date of the base log files last modification.
A maximum number of backups based on date/time boundries would be nice but is not yet implemented.
@author Kevin Steppe
@author Heinz Richter
@author Eirik Lygre
@author Ceki Gülcü
@author Martin Ritchie
| |
| |