Eclipse运行Hadoop程序时控制台无法打印进度信息解决办法
将Hadoop升级到了2.4.0,直接使用Eclipse的Hadoop插件新建了一个MapReduce Project,但是在Eclipse运行Hadoop程序时看不到进度信息,只输出如下内容:
log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
这是因为我们没有给出日志信息打印模块log4j的配置信息
解决办法:在 src 目录下新建 log4j.properties 文件,文件内容如下:
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n
log4j.appender.logfile=org.apache.log4j.FileAppender
log4j.appender.logfile.File=target/spring.log
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n