在运行爬虫或者其他Hadoop任务的时候,会报一下错误:
task_0035_m_000005_0: log4j:ERROR setFile(null,true) call failed.
task_0035_m_000005_0: java.io.FileNotFoundException:
/data/sengine/search/bin/../logs (Is a directory)
task_0035_m_000005_0: at java.io.FileOutputStream.openAppend(Native
Method)
task_0035_m_000005_0: at java.io.FileOutputStream.(
FileOutputStream.java:177)
task_0035_m_000005_0: at java.io.FileOutputStream.(
FileOutputStream.java:102)
task_0035_m_000005_0: at org.apache.log4j.FileAppender.setFile(
FileAppender.java:289)
task_0035_m_000005_0: at org.apache.log4j.FileAppender.activateOptions(
FileAppender.java:163)
task_0035_m_000005_0: at
org.apache.log4j.DailyRollingFileAppender.activateOptions(
DailyRollingFileAppender.java:215)
task_0035_m_000005_0: at org.apache.log4j.config.PropertySetter.activate(
PropertySetter.java:256)
task_0035_m_000005_0: at
org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java
:132)
task_0035_m_000005_0: at
org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:96)
task_0035_m_000005_0: at
org.apache.log4j.PropertyConfigurator.parseAppender(
PropertyConfigurator.java:654)
task_0035_m_000005_0: at
org.apache.log4j.PropertyConfigurator.parseCategory(
PropertyConfigurator.java:612)
task_0035_m_000005_0: at
org.apache.log4j.PropertyConfigurator.configureRootCategory(
PropertyConfigurator.java:509)
task_0035_m_000005_0: at org.apache.log4j.PropertyConfigurator.doConfigure
(PropertyConfigurator.java:415)
task_0035_m_000005_0: at org.apache.log4j.PropertyConfigurator.doConfigure
(PropertyConfigurator.java:441)
task_0035_m_000005_0: at
org.apache.log4j.helpers.OptionConverter.selectAndConfigure(
OptionConverter.java:468)
task_0035_m_000005_0: at org.apache.log4j.LogManager.(
LogManager.java:122)
task_0035_m_000005_0: at org.apache.log4j.Logger.getLogger(Logger.java
:104)
task_0035_m_000005_0: at
org.apache.commons.logging.impl.Log4JLogger.getLogger(Log4JLogger.java:229)
task_0035_m_000005_0: at org.apache.commons.logging.impl.Log4JLogger
.(Log4JLogger.java:65)
task_0035_m_000005_0: at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
task_0035_m_000005_0: at
sun.reflect.NativeConstructorAccessorImpl.newInstance(
NativeConstructorAccessorImpl.java:39)
task_0035_m_000005_0: at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
DelegatingConstructorAccessorImpl.java:27)
task_0035_m_000005_0: at java.lang.reflect.Constructor.newInstance(
Constructor.java:513)
task_0035_m_000005_0: at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(
LogFactoryImpl.java:529)
task_0035_m_000005_0: at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(
LogFactoryImpl.java:235)
task_0035_m_000005_0: at org.apache.commons.logging.LogFactory.getLog(
LogFactory.java:370)
task_0035_m_000005_0: at org.apache.hadoop.mapred.TaskTracker.(
TaskTracker.java:82)
task_0035_m_000005_0: at org.apache.hadoop.mapred.TaskTracker$Child.main(
TaskTracker.java:1423)
task_0035_m_000005_0: log4j:ERROR Either File or DatePattern options are not
set for appender [DRFA].
task_0035_m_000004_0: log4j:ERROR setFile(null,true) call failed.
该错误是由于Nutch 0.9的Log4J 配置不完整造成的,
打开 conf/log4j.properties加入以下两个参数
hadoop.log.dir=.
hadoop.log.file=hadoop.log
即可。