You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Stanley Xu <we...@gmail.com> on 2011/02/17 07:54:29 UTC

How could I let my map-reduce job use the log4j.properties configuration in the jar file contains the map-reduce classes?

Dear Buddies,

I am running a map reduce job in a jar file through the shell like the
following:

#! /bin/sh
export HADOOP_CLASSPATH=/home/xuwh/log-fetcher.jar
export CLASSPATH=/home/xuwh/:$CLASSPATH
/opt/hadoop/bin/hadoop
com.companyname.context.processor.log.preprocessor.LogCleaner

In the LogCleaner class, besides submitting the map-reduce job, I will wait
for the job completion and send the result to a server for further
processing.

I added some logs through log4j in the log uploading part and I wanted to
receive the error logs through an SMTP appender, and I created my own
log4j.properties file in the jar contains the LogCleaner but it didn't work.

I don't want to change the log configuration in the hadoop for I have to
change the configuration in all nodes. And different map-reduce jar might
have different configuration in log4j.

Is there any way I could make the log4j code in jar file using the
log4j.properties inside the jar? Not the code in the map-reduce job, but the
code to setup the job and the code to process after the job is completed.

Thanks.

Best wishes,
Stanley Xu