为什么我的 log4j.properties 文件没有被使用? [英] Why isn't my log4j.properties file getting used?

查看:29
本文介绍了为什么我的 log4j.properties 文件没有被使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的当前目录中有一个 log4j.properties 文件,它指定了一些要在 DEBUG 级别记录的内容,其他所有内容都作为 INFO:

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

我从 ant 运行项目:

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>

但出于某种原因,我得到的唯一输出来自 LOG.info(),而不是 LOG.debug.我确定这是微不足道的事情,但我已经用头撞墙一个小时了,我想我会尝试一下.

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.

推荐答案

当前目录默认不包含在类路径中.您是否明确添加了它?

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

这篇关于为什么我的 log4j.properties 文件没有被使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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