private boolean maybeRolloverWriterForDay() throws IOException {
      if (writer == null || !logger.getNow().toLocalDate().equals(writerDate)) {
        if (writer != null) {
          // Day change over case, reset the logFileCount.
          logFileCount = 0;
          IOUtils.closeQuietly(writer);
          writer = null;
        }
        // increment log file count, if creating a new writer.
        writer = logger.getWriter(logFileName + "_" + ++logFileCount);
        writerDate = logger.getDateFromDir(writer.getPath().getParent().getName());
        return true;
      }
      return false;
    }
Log events from hive hook using protobuf serialized format, partitioned by date.
ql/src/java/org/apache/hadoop/hive/ql/hooks/HiveProtoLoggingHook.java