本文介绍了执行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:

请告诉我如何正确初始化log4j.谢谢.

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

推荐答案

刚刚找到解决方案:创建属性文件,如下所示.并将文件放在mahout/src/conf下(mahout在mahout/conf下有一个log4j.properties,这不是正确的路径,并且未正确设置附加程序).希望这可以帮助遇到相同问题的其他人.

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警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!