Short Description:
The proper way to set the Log4j level on MapReduce jobs at launch time for Apache Hadoop 2.x.
Article
One of the most common questions I come across when trying to help debug MapReduce jobs is: “How do I change the Log4j level for my job?” Many times, a user has a JAR with a class that implements Tool that they invoke using the hadoop jar command. The desire is to change the log level without changing any code or global configuration files:
hadoop jar MyApplication.jar com.myorg.application.ApplicationJob
hadoop jar MyApplication.jar com.myorg.application.ApplicationJob -Dmapreduce.map.log.level=DEBUG <args ...>
To set the WARN Log4j level on Reducers:
hadoop jar MyApplication.jar com.myorg.application.ApplicationJob -Dmapreduce.reduce.log.level=WARN <args ...>
To set the DEBUG Log4j level on the MapReduce Application Master:
hadoop jar MyApplication.jar com.myorg.application.ApplicationJob -Dyarn.app.mapreduce.am.log.level=DEBUG <args ...>
And, of course, each of these options can be used with one another:
hadoop jar MyApplication.jar com.myorg.application.ApplicationJob -Dmapreduce.map.log.level=DEBUG -Dmapreduce.reduce.log.level=DEBUG -Dyarn.app.mapreduce.am.log.level=DEBUG <args ...>