protected boolean appendToFile(String filePath, String text) {
    EnumSet<StandardOpenOption> options = EnumSet.of(StandardOpenOption.APPEND);
    if (!Files.exists(Paths.get(filePath))) {
      options.add(StandardOpenOption.CREATE);
    }
    SeekableByteChannel seekableByteChannel = getFd(filePath, options);
    try {
      seekableByteChannel.write(ByteBuffer.wrap(
          String.join(COLUMN_SEPARATOR, DATE_FORMAT.format(System.currentTimeMillis()), text).getBytes(StandardCharsets.UTF_8)));
      return true;
    } catch (IOException e) {
      logger.error(e.toString());
      return false;
    }
  }
Append to a given file.
Creates the file if absent.
@param filePath Path of the file in the system
@param text Text to append
@return True if append was successful, false otherwise
ambry-replication/src/main/java/com/github/ambry/replication/BackupCheckerFileManager.java