Why isn't my log4j.properties file getting used?

核能气质少年 提交于 2019-12-11 09:56:45

问题


I have a log4j.properties file in my current directory that specifies some things to log at DEBUG level, and everything else as INFO:

log4j.rootLogger=WARN, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%5p] %d{mm:ss} (%F:%M:%L)%n%m%n%n

log4j.logger.com.xcski=DEBUG
log4j.logger.org.apache.nutch.protocol.http=DEBUG
log4j.logger.org.apache.nutch.fetcher.Fetcher=DEBUG

And I run the project from ant:

<target name="crawl" depends="compile">
  <java classname="com.xcski.nutch.crawler.Crawler"
        maxmemory="1000m" fork="true">
      <classpath refid="run.classpath"/>
  </java>
</target>

But for some reason, the only output I get is from LOG.info(), not LOG.debug. I'm sure it's something trivial, but I've been beating my head against the wall for an hour now and I thought I'd try SO.


回答1:


Current directory is not by default included in classpath. Did you add it explicitly?



来源:https://stackoverflow.com/questions/1284952/why-isnt-my-log4j-properties-file-getting-used

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!