WordCount案例运行报错org.apache.hadoop.metrics2.lib.MutableMetricsFactory

tech2023-01-22  120

WordCount案例报错log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory).

解决方法:

在resources文件夹中新建log4j.properties文件添加以下内容: hadoop.root.logger=DEBUG, console log4j.rootLogger = DEBUG, console log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.target=System.out log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n 在WordCountDriver的main方法最前面添加以下代码 BasicConfigurator.configure(); //自动快速地使用缺省Log4j环境

问题就成功解决了!!

最新回复(0)