[logback-dev] svn commit: r1000 - logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling
noreply.seb at qos.ch
noreply.seb at qos.ch
Fri Nov 24 16:57:01 CET 2006
Author: seb
Date: Fri Nov 24 16:57:01 2006
New Revision: 1000
Modified:
logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeBasedTriggeringPolicy.java
Log:
Now using FileSize in SizeBasedTriggeringPolicy
Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeBasedTriggeringPolicy.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeBasedTriggeringPolicy.java (original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeBasedTriggeringPolicy.java Fri Nov 24 16:57:01 2006
@@ -12,6 +12,8 @@
import java.io.File;
+import ch.qos.logback.core.util.FileSize;
+
/**
* SizeBasedTriggeringPolicy looks at size of the file being
* currently written to. If it grows bigger than the specified size,
@@ -31,8 +33,8 @@
*/
public static final long DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024; // 10 MB
- String maxFileSize = Long.toString(DEFAULT_MAX_FILE_SIZE);
- long maxFileSizeAsLong;
+ String maxFileSizeAsString = Long.toString(DEFAULT_MAX_FILE_SIZE);
+ FileSize maxFileSize;
public SizeBasedTriggeringPolicy() {
}
@@ -43,16 +45,16 @@
public boolean isTriggeringEvent(final File activeFile, final Object event) {
//System.out.println("Size"+file.length());
- return (activeFile.length() >= maxFileSizeAsLong);
+ return (activeFile.length() >= maxFileSize.getSize());
}
public String getMaxFileSize() {
- return maxFileSize;
+ return maxFileSizeAsString;
}
public void setMaxFileSize(String maxFileSize) {
- this.maxFileSize = maxFileSize;
- this.maxFileSizeAsLong = toFileSize(maxFileSize);
+ this.maxFileSizeAsString = maxFileSize;
+ this.maxFileSize = FileSize.valueOf(maxFileSize);
}
long toFileSize(String value) {
More information about the logback-dev
mailing list