From ac78d88cd5f3813e5be0b1d9d8b0328476f2c5ba Mon Sep 17 00:00:00 2001 From: Jonas Kalderstam Date: Thu, 23 Feb 2017 11:54:48 +0100 Subject: [PATCH] Don't log if log file can't be opened after rotation --- .../org/neo4j/logging/RotatingFileOutputStreamSupplier.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/community/logging/src/main/java/org/neo4j/logging/RotatingFileOutputStreamSupplier.java b/community/logging/src/main/java/org/neo4j/logging/RotatingFileOutputStreamSupplier.java index e6f482c7e9592..917191120f182 100644 --- a/community/logging/src/main/java/org/neo4j/logging/RotatingFileOutputStreamSupplier.java +++ b/community/logging/src/main/java/org/neo4j/logging/RotatingFileOutputStreamSupplier.java @@ -83,12 +83,11 @@ public void rotationError( Exception e, OutputStream out ) private final List> archivedStreams = new LinkedList<>(); // Used only in case no new output file can be created during rotation - private static final OutputStream stdErrStream = new OutputStream() + private static final OutputStream nullStream = new OutputStream() { @Override public void write( int i ) throws IOException { - System.err.write( i ); } }; @@ -290,7 +289,8 @@ private void rotate() } catch ( IOException e ) { - newStream = stdErrStream; + System.err.println( "Failed to open log file after log rotation: " + e.getMessage() ); + newStream = nullStream; rotationListener.rotationError( e, streamWrapper ); rotating.set( false ); }