/** * Flush any pending data in the {@link #logBuffer} * * @throws IOException If closing the stream fails. */ @Override public void close() throws IOException { // first close the parent so we get all remaining data super.close(); // then ensure that any remaining buffer is logged synchronized (logBuffer) { if(logBuffer.length() > 0) { log.info(logBuffer.toString()); logBuffer.setLength(0); lastFlush = System.currentTimeMillis(); } } } }