Skip to content

Commit

Permalink
Don't log if log file can't be opened after rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
spacecowboy committed Feb 23, 2017
1 parent 2f7767f commit ac78d88
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -83,12 +83,11 @@ public void rotationError( Exception e, OutputStream out )
private final List<WeakReference<OutputStream>> 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 );
}
};

Expand Down Expand Up @@ -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 );
}
Expand Down

0 comments on commit ac78d88

Please sign in to comment.