1

我需要从我的 hadoop mapreduce 作业中打印跟踪和调试消息,同时将 hadoop 系统消息保持在默认级别(默认为 INFO)。

我尝试了以下方法:

在 Job 方法中添加了 logger 消息:

package org.example.mapreducejob

public void reduce(Text extId, Iterable<MyData>> myDataItems, Context context)
        throws IOException, InterruptedException {
    log.debug("reduce(): i want this message to be printed in the userlogs");
    log.info("reduce(): Info message");
    ...
}

然后在 $HADOOP_HOME/conf/log4.properties 我添加了这一行: log4j.logger.com.terapeak.etl=DEBUG

并重新启动节点

但是,用户日志中只出现“信息消息”。我应该在哪里更改记录器配置以启用用户作业的调试消息?

4

2 回答 2

2

我找到了答案。在 $HADOOP_HOME/conf 中有两个 log4.properties 的配置文件:

log4j.properties
task-log4j.properties

要更改用户作业的日志级别,您需要在task-log4j.properties

于 2013-11-06T17:34:56.333 回答
0

请试试

log4j.logger.org.apache.hadoop = DEBUG
于 2013-11-06T16:50:46.757 回答