Abstract: Syn good son source: Http://www.cnblogs.com/cssdongl reprint please indicate the source
Quick mark the details of this command, lest later use and forget
We all know that you can use echo to output content to a file, such as echo "Hello,word" >> temp.txt
So what do I do now to output the screen of Hadoop or Spark's command to a file? Very simple, the command is as follows
Hadoop jar *.jar $mrClass > Mr.log 2>&1
Note the above command *.jar and $mrclass are replaced with their own jar package name and class.
Note that the 2>&1 in the back is critical, essential, and without the content output of the Hadoop jar execution process cannot be seen in Mr.log
Explain 2>&1.
1 stands for standard output, 2 for standard error
Then the command followed by 2>&1 means that the standard error and standard output of the command execution are redirected to Mr.log.
The contents of the screen output of the Linux command are redirected to the log file