private void log(String s) throws IOException {
    userWriter.append(s);
    userWriter.append("\n");
    if (userWriter instanceof OutputStream) 
      ((OutputStream)userWriter).flush();
    if (userWriter instanceof Writer) 
      ((Writer)userWriter).flush();
  }