public final class AbsoluteMinFreeDiskSpaceLogFileScavenger extends AbstractLogFileScavenger
Requires Java 6 and up.
The use case of this Scavenger is when you want to use all but a certain amount of your disk space for log file to keep as much logs as your system permits without worrying about running out of disk space.
To determine free disk space, the AbsoluteMinFreeDiskSpaceLogFileScavenger
calls File.getUsableSpace(). Javadoc says this method "Returns
the number of bytes available to this virtual machine on the partition named
by this abstract pathname...".
When running more than one AbsoluteMinFreeDiskSpaceLogFileScavenger (e.g. in multiple applications or for different appenders) on the same partition, care must be taken when configuring them: All AbsoluteMinFreeDiskSpaceLogFileScavenger working on the same partition must have the same value for MinFreeDiskSpace. If this is not the case and the partition fills up, the scavenger with the highest MinFreeDiskSpace value will start deleting it's log files. Because of this scavenger deleting log files, the other scavengers will not start deleting log files because their MinFreeDiskSpace is lower and will not be hit. Finally the scavenger with the highest MinFreeDiskSpace will have deleted all it's log files (which is likely not what should happen!) and only then the disk may fill further so that the scavengers with the lower MinFreeDiskSpace will start deleting logs.
| Constructor and Description |
|---|
AbsoluteMinFreeDiskSpaceLogFileScavenger() |
| Modifier and Type | Method and Description |
|---|---|
void |
scavenge() |
begin, end, getAppender, getProperties, init, logFileList, run