code: public void startMonitoring()
      throws IOException 
    {
      if (file == null) {
        writer = new PrintWriter(new BufferedOutputStream(System.out));
      } else {
        writer = new PrintWriter(new FileWriter(file, true));
      }
      super.startMonitoring();
    }
docs: Starts or restarts monitoring, by opening in append-mode, the
  file specified by the <code>fileName</code> attribute,
  if specified. Otherwise the data will be written to standard
  output.