I am开发者_如何学C trying to debug the WordCount example of Cloudera Hadoop but I can't. I've logged the mapper and the reducer class, but in the console doesn't appear the log.
I attach the images. In first image, the Java logs.
In the second imagen, the result logs. It doesn't appear the first one :( http://i56.tinypic.com/2eztkli.png
Anyone knows?? Thanks a lot!!
You are doing "hadoop jar ..." so you are starting your job using an actual Hadoop cluster (perhaps single node).
This means that all logging is done by the cluster and not on the console. What you see on the console is essentially only a progress indicator.
Your job is split into one or more map tasks and one or more reduce tasks. Each of those tasks is a separate java process and will have individual logging ( which consists of several files).
You should find those logfiles in $HADOOP_LOG_DIR/userlogs
Because a lot of things are done in parallel you do no want these logfiles to be 'one' huge logfile. It would become a useless mess.
Now for learning and developing hadoop applications there is an easier way out: Simply run your application in local mode by simply starting it as a normal Java app: java -jar ...
Oh it's a simple fix. Use System.out.println() and then look on the HTML interface of the jobtracker. Go to the task that has done Map or Reduce, which one contains the println, and then if you go on to the log report for that task, you'll find your outputs printed out there.
If you want to show information in the console then do System.out.println("blah"); in your Java jobs, it works well especially when passing arguments (e.g. usage if arguments are wrong) and doing more than just 1 single job in your jar, etc. Sifting through the Hadoop logs is tedious best to just punt to the console if you are doing real work.
精彩评论