[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v_0.9.25-3-g829d2fd
added by portage for gitosis-gentoo
git-noreply at pixie.qos.ch
Thu Oct 14 22:50:46 CEST 2010
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via 829d2fd4841611d239af073e7900c86b09e177b6 (commit)
from bd0c4d0404d7f3da36eba88853ffd0fc7688b3c6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=829d2fd4841611d239af073e7900c86b09e177b6
http://github.com/ceki/logback/commit/829d2fd4841611d239af073e7900c86b09e177b6
commit 829d2fd4841611d239af073e7900c86b09e177b6
Author: Ceki Gulcu <ceki at qos.ch>
Date: Thu Oct 14 22:49:57 2010 +0200
fix LBCORE-114
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/FixedWindowRollingPolicy.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/FixedWindowRollingPolicy.java
index 7fb2385..556f45e 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/FixedWindowRollingPolicy.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/FixedWindowRollingPolicy.java
@@ -96,6 +96,7 @@ public class FixedWindowRollingPolicy extends RollingPolicyBase {
compressor = new Compressor(compressionMode);
compressor.setContext(this.context);
+ super.start();
}
public void rollover() throws RolloverFailure {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java
index ad4594e..d7ce3a0 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java
@@ -80,6 +80,13 @@ public class RollingFileAppender<E> extends FileAppender<E> {
}
@Override
+ public void stop() {
+ if(rollingPolicy != null) rollingPolicy.stop();
+ if(triggeringPolicy != null) triggeringPolicy.stop();
+ super.stop();
+ }
+
+ @Override
public void setFile(String file) {
// http://jira.qos.ch/browse/LBCORE-94
// allow setting the file name to null if mandated by prudent mode
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeBasedTriggeringPolicy.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeBasedTriggeringPolicy.java
index eacffa8..b91c125 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeBasedTriggeringPolicy.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeBasedTriggeringPolicy.java
@@ -50,7 +50,7 @@ public class SizeBasedTriggeringPolicy<E> extends TriggeringPolicyBase<E> {
// its values may *not* be incremented sequentially. However, we don't care
// about the actual value of the field except that from time to time the
// expression (invocationCounter++ & 0xF) == 0xF) should be true.
- private int invocationCounter;
+ private int invocationCounter = 0xF;
public boolean isTriggeringEvent(final File activeFile, final E event) {
// for performance reasons, check for changes every 16 invocations
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java
index 16be2a8..9cb62d5 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java
@@ -91,6 +91,8 @@ public class TimeBasedRollingPolicy<E> extends RollingPolicyBase implements
archiveRemover = timeBasedFileNamingAndTriggeringPolicy.getArchiveRemover();
archiveRemover.setMaxHistory(maxHistory);
}
+
+ super.start();
}
public void setTimeBasedFileNamingAndTriggeringPolicy(
diff --git a/logback-core/src/test/java/ch/qos/logback/core/rolling/RollingFileAppenderTest.java b/logback-core/src/test/java/ch/qos/logback/core/rolling/RollingFileAppenderTest.java
index 659d4a4..8445c77 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/rolling/RollingFileAppenderTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/rolling/RollingFileAppenderTest.java
@@ -67,7 +67,7 @@ public class RollingFileAppenderTest extends AbstractAppenderTest<Object> {
protected Appender<Object> getConfiguredAppender() {
rfa.setContext(context);
tbrp
- .setFileNamePattern(CoreTestConstants.OUTPUT_DIR_PREFIX + "toto-%d.log");
+ .setFileNamePattern(CoreTestConstants.OUTPUT_DIR_PREFIX + "toto-%d.log");
tbrp.start();
rfa.setRollingPolicy(tbrp);
@@ -84,7 +84,7 @@ public class RollingFileAppenderTest extends AbstractAppenderTest<Object> {
rfa.setPrudent(true);
tbrp
- .setFileNamePattern(CoreTestConstants.OUTPUT_DIR_PREFIX + "toto-%d.log");
+ .setFileNamePattern(CoreTestConstants.OUTPUT_DIR_PREFIX + "toto-%d.log");
tbrp.start();
rfa.setRollingPolicy(tbrp);
@@ -101,7 +101,7 @@ public class RollingFileAppenderTest extends AbstractAppenderTest<Object> {
rfa.setAppend(false);
rfa.setPrudent(true);
- tbrp.setFileNamePattern("toto-%d.log.zip");
+ tbrp.setFileNamePattern(CoreTestConstants.OUTPUT_DIR_PREFIX + "toto-%d.log.zip");
tbrp.start();
rfa.setRollingPolicy(tbrp);
@@ -120,7 +120,7 @@ public class RollingFileAppenderTest extends AbstractAppenderTest<Object> {
StatusPrinter.print(context);
StatusChecker statusChecker = new StatusChecker(context.getStatusManager());
statusChecker.containsMatch(Status.ERROR,
- "File property must be set before any triggeringPolicy ");
+ "File property must be set before any triggeringPolicy ");
}
@Test
@@ -130,7 +130,7 @@ public class RollingFileAppenderTest extends AbstractAppenderTest<Object> {
rfa.setFile("x");
StatusChecker statusChecker = new StatusChecker(context.getStatusManager());
statusChecker.containsMatch(Status.ERROR,
- "File property must be set before any triggeringPolicy ");
+ "File property must be set before any triggeringPolicy ");
}
@Test
@@ -139,10 +139,59 @@ public class RollingFileAppenderTest extends AbstractAppenderTest<Object> {
// java.lang.IllegalStateException: FileNamePattern [.../program(x86)/toto-%d.log] does not contain a valid DateToken
rfa.setContext(context);
tbrp
- .setFileNamePattern(randomOutputDir + "program(x86)/toto-%d.log");
+ .setFileNamePattern(randomOutputDir + "program(x86)/toto-%d.log");
tbrp.start();
rfa.setRollingPolicy(tbrp);
rfa.start();
rfa.doAppend("hello");
}
+
+ @Test
+ public void stopTimeBasedRollingPolicy() {
+ rfa.setContext(context);
+
+ tbrp.setFileNamePattern(CoreTestConstants.OUTPUT_DIR_PREFIX + "toto-%d.log.zip");
+ tbrp.start();
+ rfa.setRollingPolicy(tbrp);
+ rfa.start();
+
+ StatusPrinter.print(context);
+ assertTrue(tbrp.isStarted());
+ assertTrue(rfa.isStarted());
+ rfa.stop();
+ assertFalse(rfa.isStarted());
+ assertFalse(tbrp.isStarted());
+
+ }
+
+ @Test
+ public void stopFixedWindowRollingPolicy() {
+ rfa.setContext(context);
+ rfa.setFile(CoreTestConstants.OUTPUT_DIR_PREFIX + "toto-.log");
+
+ FixedWindowRollingPolicy fwRollingPolicy = new FixedWindowRollingPolicy();
+ fwRollingPolicy.setContext(context);
+ fwRollingPolicy.setFileNamePattern(CoreTestConstants.OUTPUT_DIR_PREFIX + "toto-%i.log.zip");
+ fwRollingPolicy.setParent(rfa);
+ fwRollingPolicy.start();
+ SizeBasedTriggeringPolicy sbTriggeringPolicy = new SizeBasedTriggeringPolicy();
+ sbTriggeringPolicy.setContext(context);
+ sbTriggeringPolicy.start();
+
+ rfa.setRollingPolicy(fwRollingPolicy);
+ rfa.setTriggeringPolicy(sbTriggeringPolicy);
+
+ rfa.start();
+
+ StatusPrinter.print(context);
+ assertTrue(fwRollingPolicy.isStarted());
+ assertTrue(sbTriggeringPolicy.isStarted());
+ assertTrue(rfa.isStarted());
+ rfa.stop();
+ assertFalse(rfa.isStarted());
+ assertFalse(fwRollingPolicy.isStarted());
+ assertFalse(sbTriggeringPolicy.isStarted());
+
+ }
+
}
diff --git a/logback-site/src/site/pages/news.html b/logback-site/src/site/pages/news.html
index 5e4e61e..32f4256 100644
--- a/logback-site/src/site/pages/news.html
+++ b/logback-site/src/site/pages/news.html
@@ -28,6 +28,15 @@
<hr width="80%" align="center" />
+
+ <h3>xxxx, 2010 - Release of version 0.9.26</h3>
+
+
+ <p>When stopped, <code>RollingFileAppender</code> now calls
+ <code>stop()</code> on its policy objects, fixing <a
+ href="http://jira.qos.ch/browse/LBCORE-114">LBCORE-114</a>
+ reported by Anders Wallgren.</p>
+
<h3>October 13th, 2010 - Release of version 0.9.25</h3>
<p>Logback-classic now supports <a
-----------------------------------------------------------------------
Summary of changes:
.../core/rolling/FixedWindowRollingPolicy.java | 1 +
.../logback/core/rolling/RollingFileAppender.java | 7 ++
.../core/rolling/SizeBasedTriggeringPolicy.java | 2 +-
.../core/rolling/TimeBasedRollingPolicy.java | 2 +
.../core/rolling/RollingFileAppenderTest.java | 61 ++++++++++++++++++--
logback-site/src/site/pages/news.html | 9 +++
6 files changed, 75 insertions(+), 7 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
More information about the logback-dev
mailing list