Skip to content

Commit 4fef348

Browse files
committed
Configuration error totalSizeCap is smaller than maxFileSize is unnecessary when using compressed archive files issues/1007
Signed-off-by: ceki <ceki@qos.ch>
1 parent 0bdecc6 commit 4fef348

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!--
2+
~ Logback: the reliable, generic, fast and flexible logging framework.
3+
~ Copyright (C) 1999-2026, QOS.ch. All rights reserved.
4+
~
5+
~ This program and the accompanying materials are dual-licensed under
6+
~ either the terms of the Eclipse Public License v2.0 as published by
7+
~ the Eclipse Foundation
8+
~
9+
~ or (per the licensee's choosing)
10+
~
11+
~ under the terms of the GNU Lesser General Public License version 2.1
12+
~ as published by the Free Software Foundation.
13+
-->
14+
15+
<configuration xscan="true" scanPeriod="50 millisecond">
16+
17+
<include resource="asResource/inner1.xml"/>
18+
</configuration>

logback-core/src/main/java/ch/qos/logback/core/joran/util/ConfigurationWatchListUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public static void addToWatchList(Context context, URL url, boolean createCWL) {
8282
if(createCWL && ConfigurationWatchList.isWatchableProtocol(url)) {
8383
cwl = registerNewConfigurationWatchListWithContext(context);
8484
} else {
85-
addWarn(context, "Null ConfigurationWatchList. Cannot add " + url);
85+
addInfo(context, "ConfigurationWatchList not initialized due to absence of scan directive. Will not add " + url);
8686
return;
8787
}
8888
}

logback-core/src/main/java/ch/qos/logback/core/rolling/SizeAndTimeBasedRollingPolicy.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
public class SizeAndTimeBasedRollingPolicy<E> extends TimeBasedRollingPolicy<E> {
2020

21+
static long MAX_COMPRESSION_FACTOR = 20;
22+
2123
FileSize maxFileSize;
2224

2325
@Override
@@ -33,10 +35,9 @@ public void start() {
3335
sizeAndTimeBasedFNATP.setMaxFileSize(maxFileSize);
3436
timeBasedFileNamingAndTriggeringPolicy = sizeAndTimeBasedFNATP;
3537

36-
if (!isUnboundedTotalSizeCap() && totalSizeCap.getSize() < maxFileSize.getSize()) {
37-
addError("totalSizeCap of [" + totalSizeCap + "] is smaller than maxFileSize [" + maxFileSize
38-
+ "] which is non-sensical");
39-
return;
38+
if (!isUnboundedTotalSizeCap() && totalSizeCap.getSize() < maxFileSize.getSize()/MAX_COMPRESSION_FACTOR) {
39+
addWarn("totalSizeCap of [" + totalSizeCap + "] is much smaller than maxFileSize [" + maxFileSize
40+
+ "] which is non-sensical, even taking compression into account.");
4041
}
4142

4243
// most work is done by the parent

0 commit comments

Comments
 (0)