1
votes

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 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.

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

1

1 Answers

1
votes

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