[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, encoder, updated. v0.9.18-36-gb90d74b
added by portage for gitosis-gentoo
git-noreply at pixie.qos.ch
Sun Feb 21 23:19:31 CET 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, encoder has been updated
via b90d74bcaadef20e47ac469d51fee1d1367ca57f (commit)
from 4316ce3c37be6fd8fbad4e9a0645bedb9a487b8e (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=b90d74bcaadef20e47ac469d51fee1d1367ca57f
http://github.com/ceki/logback/commit/b90d74bcaadef20e47ac469d51fee1d1367ca57f
commit b90d74bcaadef20e47ac469d51fee1d1367ca57f
Author: Ceki Gulcu <ceki at gimmel.(none)>
Date: Sun Feb 21 23:16:39 2010 +0100
- FileAppenderResilience test passes altough the code is still a mess.
diff --git a/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java b/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java
index b0b7980..0ae0343 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java
@@ -23,14 +23,15 @@ import java.nio.channels.FileChannel;
public class ResilientFileOutputStream extends OutputStream {
RecoveryCoordinator recoveryCoordinator;
- // private FileChannel fileChannel = null;
boolean bufferedIO;
int bufferSize;
FileOutputStream fos;
File file;
+ boolean presumedClean = true;
- public ResilientFileOutputStream(File file, boolean append) throws FileNotFoundException {
+ public ResilientFileOutputStream(File file, boolean append)
+ throws FileNotFoundException {
this.file = file;
fos = new FileOutputStream(file, append);
}
@@ -44,7 +45,7 @@ public class ResilientFileOutputStream extends OutputStream {
public void write(byte b[], int off, int len) throws IOException {
// existence of recoveryCoordinator indicates failed state
- if (recoveryCoordinator != null) {
+ if (recoveryCoordinator != null && !presumedClean) {
if (!recoveryCoordinator.isTooSoon()) {
performRecoveryAttempt();
}
@@ -56,6 +57,7 @@ public class ResilientFileOutputStream extends OutputStream {
fos.write(b, off, len);
postSuccessfulWrite();
} catch (IOException e) {
+ presumedClean = false;
recoveryCoordinator = new RecoveryCoordinator();
}
}
@@ -66,11 +68,11 @@ public class ResilientFileOutputStream extends OutputStream {
@Override
public void close() throws IOException {
- if(fos != null) {
+ if (fos != null) {
fos.close();
}
}
-
+
@Override
public void write(int b) throws IOException {
// existence of recoveryCoordinator indicates failed state
@@ -90,7 +92,14 @@ public class ResilientFileOutputStream extends OutputStream {
}
void performRecoveryAttempt() throws FileNotFoundException {
- fos = new FileOutputStream(file);
+ try {
+ close();
+ } catch (IOException e) {
+ }
+
+ // subsequent writes must always be in append mode
+ fos = new FileOutputStream(file, true);
+ presumedClean = true;
}
}
-----------------------------------------------------------------------
Summary of changes:
.../core/recovery/ResilientFileOutputStream.java | 21 ++++++++++++++-----
1 files changed, 15 insertions(+), 6 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
More information about the logback-dev
mailing list