Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-6746

hadoop-daemon.sh does not append to log files

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 2.2.0
    • None
    • None
    • Open log files with append (rather than creating new files) so file truncation works. This allows log rotation tools to operate correctly without restarting Hadoop processes.

    Description

      Looking in hadoop-daemon.sh we see the start command redirects logs to the log file by creating a new file. It does not append to the log.

      nohup nice -n $HADOOP_NICENESS "$HADOOP_HOME"/bin/hadoop --config $HADOOP_CONF_DIR $command "$@" > "$log" 2>&1 < /dev/null &

      I believe output should be appended to the log file so logrotate copytruncate works. Currently a large log file cannot be truncated without restarting the running service, which causes issues in production environments.

      The improved line would be exactly the same, except use >> to open the log file in append mode.

      nohup nice -n $HADOOP_NICENESS "$HADOOP_HOME"/bin/hadoop --config $HADOOP_CONF_DIR $command "$@" >> "$log" 2>&1 < /dev/null &

      Attachments

        1. HADOOP-6746.patch
          0.6 kB
          Travis Crawford
        2. HADOOP-6746.2.patch
          1.0 kB
          Akira Ajisaka

        Issue Links

          Activity

            People

              aajisaka Akira Ajisaka
              traviscrawford Travis Crawford
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: