Quantcast
Viewing all articles
Browse latest Browse all 3435

JobHistory: No SysLog and log4j warn for stderr

I’m using HDP 2.2.4.2-2. I have trouble to see loggings from JobHistory. Not sure what is the configuration missed server-side or client-side.

So I have a simple wordCount program:

public class WordCount {
public static final Log LOG = LogFactory.getLog(WordCount.class);

public static class TokenizerMapper
extends Mapper<Object, Text, Text, IntWritable>{

private final static IntWritable one = new IntWritable(1);
private Text word = new Text();

public void map(Object key, Text value, Context context
) throws IOException, InterruptedException {
LOG.info("LOG - map function invoked");
System.out.println("stdout - map function invoked");
StringTokenizer itr = new StringTokenizer(value.toString());
while (itr.hasMoreTokens()) {
word.set(itr.nextToken());
context.write(word, one);
}
}
}

public static class IntSumReducer
extends Reducer<Text,IntWritable,Text,IntWritable> {
private IntWritable result = new IntWritable();

public void reduce(Text key, Iterable values,
Context context
) throws IOException, InterruptedException {
int sum = 0;
for (IntWritable val : values) {
sum += val.get();
}
result.set(sum);
context.write(key, result);
}
}

public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
conf.set("mapreduce.job.jar","/space/tmp/jar/wordCount.jar");
Job job = Job.getInstance(conf, "word count");
job.setJarByClass(WordCount.class);
job.setMapperClass(TokenizerMapper.class);
job.setCombinerClass(IntSumReducer.class);
job.setReducerClass(IntSumReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
FileInputFormat.addInputPath(job, new Path("hdfs://localhost:9000/user/jsun/input"));
FileOutputFormat.setOutputPath(job, new Path("hdfs://localhost:9000/user/jsun/output"));

System.exit(job.waitForCompletion(true) ? 0 : 1);
}
}

I expect some loggings in ‘stdout’ and ‘stderr’ from MapReduce job history. because I have these statement in the map function of Mapper class:

LOG.info("LOG - map function invoked");
System.out.println("stdout - map function invoded");

However, I can see nothing in ‘stdout’ and in ‘stderr’, I was told log4j not properly configured, no appenders…

Log Type: stderr
Log Upload Time: Thu Sep 10 11:30:43 -0700 2015
Log Length: 222
log4j:WARN No appenders could be found for logger (org.apache.hadoop.ipc.Server).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

Log Type: stdout
Log Upload Time: Thu Sep 10 11:30:43 -0700 2015
Log Length: 0

Log Type: syslog
Log Upload Time: Thu Sep 10 11:30:43 -0700 2015
Log Length: 41556
Showing 4096 bytes of 41556 total. Click here for the full log.
ing JobHistoryEventHandler. Size of the outstanding queue size is 0 ...

Seeking help here.


Viewing all articles
Browse latest Browse all 3435

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>