public synchronized void flush() {
    try {
      StringBuffer buffer = this.buffer.getBuffer();
      logFileOutputStream.write( buffer.toString().getBytes() );
      logFileOutputStream.flush();

    } catch ( Exception e ) {
      exception = new KettleException( "There was an error logging to file '" + logFile + "'", e );
    }
  }
@Test
  public void test() throws Exception {

    LogChannelFileWriter writer = new LogChannelFileWriter( id, fileObject, false );

    LoggingRegistry.getInstance().getLogChannelFileWriterBuffer( id ).addEvent(
            new KettleLoggingEvent( logMessage, System.currentTimeMillis(), LogLevel.BASIC ) );

    writer.flush();

    verify( outputStream ).write( captor.capture() );

    String arguments = new String( captor.getValue() );
    assertTrue( arguments.contains( logMessage ) );
  }