in src/main/java/org/apache/log4j/rolling/FixedWindowRollingPolicy.java [155:195]
public RolloverDescription rollover(final String currentFileName) {
if (maxIndex >= 0) {
int purgeStart = minIndex;
if (!explicitActiveFile) {
purgeStart++;
}
if (!purge(purgeStart, maxIndex)) {
return null;
}
StringBuffer buf = new StringBuffer();
formatFileName(new Integer(purgeStart), buf);
String renameTo = buf.toString();
String compressedName = renameTo;
Action compressAction = null;
if (renameTo.endsWith(".gz")) {
renameTo = renameTo.substring(0, renameTo.length() - 3);
compressAction =
new GZCompressAction(
new File(renameTo), new File(compressedName), true);
} else if (renameTo.endsWith(".zip")) {
renameTo = renameTo.substring(0, renameTo.length() - 4);
compressAction =
new ZipCompressAction(
new File(renameTo), new File(compressedName), true);
}
FileRenameAction renameAction =
new FileRenameAction(
new File(currentFileName), new File(renameTo), false);
return new RolloverDescriptionImpl(
currentFileName, false, renameAction, compressAction);
}
return null;
}