执行Mahout的20newsgroup分类示例时如何解决log4j警告? [英] How to resolve log4j warnings while executing 20newsgroup classification example of Mahout?

查看:66
本文介绍了执行Mahout的20newsgroup分类示例时如何解决log4j警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Mahout中运行2newsgroup分类示例.我已经设定:

I am trying to run the 2newsgroup classification example in Mahout. I have set:

MAHOUT_LOCAL = true

分类器不显示混淆矩阵,并给出以下警告:

the classifier doesn't display the Confusion matrix and gives the following warnings:

已设置MAHOUT_LOCAL,因此我们不会在类路径中添加HADOOP_CONF_DIR.
已设置MAHOUT_LOCAL,在本地运行
SLF4J:类路径包含多个SLF4J绑定.
SLF4J:在[jar:file:/usr/lib/mahout/examples/target/mahout-examples-1.0-SNAPSHOT-job.jar!/org/slf4j/impl/StaticLoggerBinder.class]中找到绑定.
SLF4J:在[jar:file:/usr/lib/mahout/examples/target/dependency/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]中找到绑定 SLF4J:在[jar:file:/usr/lib/zookeeper/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]中找到绑定
SLF4J:有关信息,请参见 http://www.slf4j.org/codes.html#multiple_bindings 一个解释. SLF4J:实际绑定的类型为[org.slf4j.impl.Log4jLoggerFactory] ​​
log4j:WARN找不到记录器的附加程序(org.apache.mahout.driver.MahoutDriver).
log4j:WARN请正确初始化log4j系统.
log4j:WARN请参见 http://logging.apache.org/log4j/1.2/faq .html#noconfig 了解更多信息.

MAHOUT_LOCAL is set, so we don't add HADOOP_CONF_DIR to classpath.
MAHOUT_LOCAL is set, running locally
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/lib/mahout/examples/target/mahout-examples-1.0-SNAPSHOT-job.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/lib/mahout/examples/target/dependency/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/lib/zookeeper/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
log4j:WARN No appenders could be found for logger (org.apache.mahout.driver.MahoutDriver).
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.谢谢.

Please tell me how should I initialise log4j properly. Thank you.

推荐答案

刚刚找到解决方案:创建属性文件

Just found out the solution: create the property file link, like below. And put the file under mahout/src/conf(mahout has one log4j.properties under mahout/conf, which is not the right path and also the appender was not set correctly). Hope this helps someone else with the same problem.

    log4j.rootLogger=DEBUG,consoleAppender, fileAppender
    log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
    log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
    log4j.appender.consoleAppender.layout.ConversionPattern=[%t] %-5p %c %x - %m%n
    log4j.appender.fileAppender=org.apache.log4j.RollingFileAppender
    log4j.appender.fileAppender.layout=org.apache.log4j.PatternLayout
    log4j.appender.fileAppender.layout.ConversionPattern=[%t] %-5p %c %x - %m%n
    log4j.appender.fileAppender.File=demoApplication.log

这篇关于执行Mahout的20newsgroup分类示例时如何解决log4j警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆