问题
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