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

LogLevel#main throws exception if no arguments provided

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.9.0
    • Fix Version/s: 2.9.0, 3.0.0-alpha2
    • Component/s: None
    • Labels:
      None

      Description

      root@b9ab37566005:/# hadoop daemonlog
      
      Usage: General options are:
      	[-getlevel <host:port> <classname> [-protocol (http|https)]
      	[-setlevel <host:port> <classname> <level> [-protocol (http|https)]
      
      Exception in thread "main" org.apache.hadoop.HadoopIllegalArgumentException: No arguments specified
      	at org.apache.hadoop.log.LogLevel$CLI.parseArguments(LogLevel.java:138)
      	at org.apache.hadoop.log.LogLevel$CLI.run(LogLevel.java:106)
      	at org.apache.hadoop.log.LogLevel.main(LogLevel.java:70)
      

      I think we can catch the exception in the main method, and dump a log error message instead of throw the stack which may frustrate users.

      1. HADOOP-13697.001.patch
        2 kB
        Mingliang Liu
      2. HADOOP-13697.000.patch
        1 kB
        Mingliang Liu

        Issue Links

          Activity

          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #10587 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10587/)
          HADOOP-13697. LogLevel#main should not throw exception if no arguments. (liuml07: rev 2fb392a587d288b628936ca6d18fabad04afc585)

          • (edit) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/log/LogLevel.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #10587 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10587/ ) HADOOP-13697 . LogLevel#main should not throw exception if no arguments. (liuml07: rev 2fb392a587d288b628936ca6d18fabad04afc585) (edit) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/log/LogLevel.java
          Hide
          liuml07 Mingliang Liu added a comment -

          Committed to trunk and branch-2. Thanks for your review, Wei-Chiu Chuang.

          Show
          liuml07 Mingliang Liu added a comment - Committed to trunk and branch-2 . Thanks for your review, Wei-Chiu Chuang .
          Hide
          jojochuang Wei-Chiu Chuang added a comment -

          Thanks for submitting the new patch. The v1 patch looks good to me.

          Show
          jojochuang Wei-Chiu Chuang added a comment - Thanks for submitting the new patch. The v1 patch looks good to me.
          Hide
          liuml07 Mingliang Liu added a comment -

          Wei-Chiu Chuang Would you review/commit the v1 patch? Thanks.

          Show
          liuml07 Mingliang Liu added a comment - Wei-Chiu Chuang Would you review/commit the v1 patch? Thanks.
          Hide
          liuml07 Mingliang Liu added a comment -

          There is tests for ToolRunner and LogLevel. No new tests needed.

          Test failure is not related, and is tracked by HDFS-10985.

          Show
          liuml07 Mingliang Liu added a comment - There is tests for ToolRunner and LogLevel. No new tests needed. Test failure is not related, and is tracked by HDFS-10985 .
          Hide
          hadoopqa Hadoop QA added a comment -
          -1 overall



          Vote Subsystem Runtime Comment
          0 reexec 0m 13s Docker mode activated.
          +1 @author 0m 0s The patch does not contain any @author tags.
          -1 test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
          +1 mvninstall 6m 51s trunk passed
          +1 compile 6m 43s trunk passed
          +1 checkstyle 0m 22s trunk passed
          +1 mvnsite 0m 55s trunk passed
          +1 mvneclipse 0m 12s trunk passed
          +1 findbugs 1m 16s trunk passed
          +1 javadoc 0m 41s trunk passed
          +1 mvninstall 0m 35s the patch passed
          +1 compile 6m 58s the patch passed
          +1 javac 6m 58s the patch passed
          +1 checkstyle 0m 22s the patch passed
          +1 mvnsite 0m 53s the patch passed
          +1 mvneclipse 0m 12s the patch passed
          +1 whitespace 0m 0s The patch has no whitespace issues.
          +1 findbugs 1m 28s the patch passed
          +1 javadoc 0m 40s the patch passed
          -1 unit 7m 17s hadoop-common in the patch failed.
          +1 asflicense 0m 20s The patch does not generate ASF License warnings.
          37m 26s



          Reason Tests
          Failed junit tests hadoop.ha.TestZKFailoverController



          Subsystem Report/Notes
          Docker Image:yetus/hadoop:9560f25
          JIRA Issue HADOOP-13697
          JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12832209/HADOOP-13697.001.patch
          Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
          uname Linux beec0a043165 3.13.0-93-generic #140-Ubuntu SMP Mon Jul 18 21:21:05 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
          Build tool maven
          Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
          git revision trunk / e57fa81
          Default Java 1.8.0_101
          findbugs v3.0.0
          unit https://builds.apache.org/job/PreCommit-HADOOP-Build/10705/artifact/patchprocess/patch-unit-hadoop-common-project_hadoop-common.txt
          Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10705/testReport/
          modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common
          Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10705/console
          Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 reexec 0m 13s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. -1 test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 mvninstall 6m 51s trunk passed +1 compile 6m 43s trunk passed +1 checkstyle 0m 22s trunk passed +1 mvnsite 0m 55s trunk passed +1 mvneclipse 0m 12s trunk passed +1 findbugs 1m 16s trunk passed +1 javadoc 0m 41s trunk passed +1 mvninstall 0m 35s the patch passed +1 compile 6m 58s the patch passed +1 javac 6m 58s the patch passed +1 checkstyle 0m 22s the patch passed +1 mvnsite 0m 53s the patch passed +1 mvneclipse 0m 12s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. +1 findbugs 1m 28s the patch passed +1 javadoc 0m 40s the patch passed -1 unit 7m 17s hadoop-common in the patch failed. +1 asflicense 0m 20s The patch does not generate ASF License warnings. 37m 26s Reason Tests Failed junit tests hadoop.ha.TestZKFailoverController Subsystem Report/Notes Docker Image:yetus/hadoop:9560f25 JIRA Issue HADOOP-13697 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12832209/HADOOP-13697.001.patch Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux beec0a043165 3.13.0-93-generic #140-Ubuntu SMP Mon Jul 18 21:21:05 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / e57fa81 Default Java 1.8.0_101 findbugs v3.0.0 unit https://builds.apache.org/job/PreCommit-HADOOP-Build/10705/artifact/patchprocess/patch-unit-hadoop-common-project_hadoop-common.txt Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10705/testReport/ modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10705/console Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
          Hide
          liuml07 Mingliang Liu added a comment -
          $ hadoop daemonlog
          Usage: Command options are:
          	[-getlevel <host:port> <classname> [-protocol (http|https)]
          	[-setlevel <host:port> <classname> <level> [-protocol (http|https)]
          
          Generic options supported are
          -conf <configuration file>     specify an application configuration file
          -D <property=value>            use value for given property
          -fs <local|namenode:port>      specify a namenode
          -jt <local|resourcemanager:port>    specify a ResourceManager
          -files <comma separated list of files>    specify comma separated files to be copied to the map reduce cluster
          -libjars <comma separated list of jars>    specify comma separated jar files to include in the classpath.
          -archives <comma separated list of archives>    specify comma separated archives to be unarchived on the compute machines.
          
          The general command line syntax is
          command [genericOptions] [commandOptions]
          
          Show
          liuml07 Mingliang Liu added a comment - $ hadoop daemonlog Usage: Command options are: [-getlevel <host:port> <classname> [-protocol (http|https)] [-setlevel <host:port> <classname> <level> [-protocol (http|https)] Generic options supported are -conf <configuration file> specify an application configuration file -D <property=value> use value for given property -fs <local|namenode:port> specify a namenode -jt <local|resourcemanager:port> specify a ResourceManager -files <comma separated list of files> specify comma separated files to be copied to the map reduce cluster -libjars <comma separated list of jars> specify comma separated jar files to include in the classpath. -archives <comma separated list of archives> specify comma separated archives to be unarchived on the compute machines. The general command line syntax is command [genericOptions] [commandOptions]
          Hide
          liuml07 Mingliang Liu added a comment -

          Thanks for your confirmation. Please kindly review v1 patch.

          Show
          liuml07 Mingliang Liu added a comment - Thanks for your confirmation. Please kindly review v1 patch.
          Hide
          hadoopqa Hadoop QA added a comment -
          -1 overall



          Vote Subsystem Runtime Comment
          0 reexec 0m 16s Docker mode activated.
          +1 @author 0m 0s The patch does not contain any @author tags.
          -1 test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
          +1 mvninstall 6m 39s trunk passed
          +1 compile 7m 8s trunk passed
          +1 checkstyle 0m 24s trunk passed
          +1 mvnsite 0m 55s trunk passed
          +1 mvneclipse 0m 12s trunk passed
          +1 findbugs 1m 26s trunk passed
          +1 javadoc 0m 44s trunk passed
          +1 mvninstall 0m 43s the patch passed
          +1 compile 8m 5s the patch passed
          +1 javac 8m 5s the patch passed
          +1 checkstyle 0m 25s the patch passed
          +1 mvnsite 0m 58s the patch passed
          +1 mvneclipse 0m 12s the patch passed
          +1 whitespace 0m 0s The patch has no whitespace issues.
          +1 findbugs 1m 41s the patch passed
          +1 javadoc 0m 42s the patch passed
          +1 unit 8m 36s hadoop-common in the patch passed.
          +1 asflicense 0m 20s The patch does not generate ASF License warnings.
          40m 54s



          Subsystem Report/Notes
          Docker Image:yetus/hadoop:9560f25
          JIRA Issue HADOOP-13697
          JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12832198/HADOOP-13697.000.patch
          Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
          uname Linux 09e4712ed5ca 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
          Build tool maven
          Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
          git revision trunk / 2e853be
          Default Java 1.8.0_101
          findbugs v3.0.0
          Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10704/testReport/
          modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common
          Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10704/console
          Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 reexec 0m 16s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. -1 test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 mvninstall 6m 39s trunk passed +1 compile 7m 8s trunk passed +1 checkstyle 0m 24s trunk passed +1 mvnsite 0m 55s trunk passed +1 mvneclipse 0m 12s trunk passed +1 findbugs 1m 26s trunk passed +1 javadoc 0m 44s trunk passed +1 mvninstall 0m 43s the patch passed +1 compile 8m 5s the patch passed +1 javac 8m 5s the patch passed +1 checkstyle 0m 25s the patch passed +1 mvnsite 0m 58s the patch passed +1 mvneclipse 0m 12s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. +1 findbugs 1m 41s the patch passed +1 javadoc 0m 42s the patch passed +1 unit 8m 36s hadoop-common in the patch passed. +1 asflicense 0m 20s The patch does not generate ASF License warnings. 40m 54s Subsystem Report/Notes Docker Image:yetus/hadoop:9560f25 JIRA Issue HADOOP-13697 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12832198/HADOOP-13697.000.patch Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux 09e4712ed5ca 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / 2e853be Default Java 1.8.0_101 findbugs v3.0.0 Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10704/testReport/ modules C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10704/console Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
          Hide
          jojochuang Wei-Chiu Chuang added a comment -

          Thanks for the correction

          I think it's beneficial to use ToolRunner in case that the user wants to run this command against a different cluster. I thought I did use ToolRunner but apparently not.

          Show
          jojochuang Wei-Chiu Chuang added a comment - Thanks for the correction I think it's beneficial to use ToolRunner in case that the user wants to run this command against a different cluster. I thought I did use ToolRunner but apparently not.
          Hide
          liuml07 Mingliang Liu added a comment -

          Thanks Wei-Chiu Chuang for your prompt comment.

          The exception is already caught is main() and rethrown.

          I guess you're talking about Cli#run instead of main()? Please see the v0 patch.

          Another point is that, should we use ToolRunner to call the Cli#run() instead of calling it directly? In that way, the ToolRunner can provided some features like setting CallerContext, accepting Generic_Options (do we plan to support that) in LogLevel?

          Show
          liuml07 Mingliang Liu added a comment - Thanks Wei-Chiu Chuang for your prompt comment. The exception is already caught is main() and rethrown. I guess you're talking about Cli#run instead of main() ? Please see the v0 patch. Another point is that, should we use ToolRunner to call the Cli#run() instead of calling it directly? In that way, the ToolRunner can provided some features like setting CallerContext , accepting Generic_Options (do we plan to support that) in LogLevel?
          Hide
          jojochuang Wei-Chiu Chuang added a comment -

          Good catch Mingliang Liu. The exception is already caught is main() and rethrown. I think the exception should not be rethrown. Instead, print the error message and return an error code.

          Show
          jojochuang Wei-Chiu Chuang added a comment - Good catch Mingliang Liu . The exception is already caught is main() and rethrown. I think the exception should not be rethrown. Instead, print the error message and return an error code.
          Hide
          liuml07 Mingliang Liu added a comment -

          Wei-Chiu Chuang any thoughts? Thanks.

          Show
          liuml07 Mingliang Liu added a comment - Wei-Chiu Chuang any thoughts? Thanks.

            People

            • Assignee:
              liuml07 Mingliang Liu
              Reporter:
              liuml07 Mingliang Liu
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development