Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public class FixedWindowRollingPolicy extends RollingPolicyBase {
public static final String ZIP_ENTRY_DATE_PATTERN = "yyyy-MM-dd_HHmm";

/**
* It's almost always a bad idea to have a large window size, say over 12.
* It's almost always a bad idea to have a large window size, say over 20.
*/
private static int MAX_WINDOW_SIZE = 12;
private static int MAX_WINDOW_SIZE = 20;

public FixedWindowRollingPolicy() {
minIndex = 1;
Expand Down Expand Up @@ -80,9 +80,10 @@ public void start() {
maxIndex = minIndex;
}

if ((maxIndex - minIndex) > MAX_WINDOW_SIZE) {
final int maxWindowSize = getMaxWindowSize();
if ((maxIndex - minIndex) > maxWindowSize) {
addWarn("Large window sizes are not allowed.");
maxIndex = minIndex + MAX_WINDOW_SIZE;
maxIndex = minIndex + maxWindowSize;
addWarn("MaxIndex reduced to " + maxIndex);
}

Expand All @@ -103,6 +104,15 @@ public void start() {
super.start();
}

/**
* Subclasses can override this method to increase the max window size, if required. This is to
* address LOGBACK-266.
* @return
*/
protected int getMaxWindowSize() {
return MAX_WINDOW_SIZE;
}

private String transformFileNamePatternFromInt2Date(String fileNamePatternStr) {
String slashified = FileFilterUtil.slashify(fileNamePatternStr);
String stemOfFileNamePattern = FileFilterUtil.afterLastSlash(slashified);
Expand Down