- All Implemented Interfaces:
- Runnable, LogFileScavenger
public final class AbsoluteMinFreeDiskSpaceLogFileScavenger
- extends AbstractLogFileScavenger
Responsible for periodically sampling the number of log files with a given
base filename and time-based extension, and for deleting the older files if
the minimum specified space remains available on the filesystem.
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
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.
|Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public void scavenge()