0

I've set up an Ant script to run unit tests with Cobertura. For some reason I'm getting the log4j DEBUG output from Cobertura. I've been staring at this for hours using all the diagnostic fu I can come up with, and I don't see why this is happening.

I used SysInternals ProcessMonitor to check to see if I manually loaded "log4j.properties" or "log4j.xml". None found.

I made Ant turn on verbose class loading, and I never saw it load either "log4j.properties" or "log4j.xml". This tells me this wasn't passed to forked processes, because I know the "cobertura.jar" has a "log4j.properties", which has the following contents:

# set default logging level and appender
log4j.rootCategory=WARN, console
#log4j.category.net.sourceforge.cobertura=WARN, console

#log4j.category.net.sourceforge.cobertura.check=DEBUG, console
#log4j.category.net.sourceforge.cobertura.coverage=DEBUG, file
#log4j.category.net.sourceforge.cobertura.coverage.CoverageDataFactory=INFO, file
#log4j.category.net.sourceforge.cobertura.coverage.SaveInstrumentationTimer=DEBUG, file
#log4j.category.net.sourceforge.cobertura.merge=DEGUG, console
#log4j.category.net.sourceforge.cobertura.reporting=DEBUG, file

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%-6p %M, %m%n

log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=cobertura.log
log4j.appender.file.MaxFileSize=3000KB
log4j.appender.file.MaxBackupIndex=3
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d %-2p [%t] %c{3} - %m - (%F:%L) %n

The only irrelevant problem in here is the misspelled "DEGUG", but that's commented out.

I can't see how else this is happening. I've been asking one of the Cobertura maintainers, and he doesn't see why this might be happening.

David M. Karr
  • 14,317
  • 20
  • 94
  • 199

1 Answers1

0

I figured it out. I had forgotten about the very handy "log4j.debug" property, which when enabled tells you where it found a "log4j.xml" or "log4j.properties" file. I found the former in an unexpected jar file, which I've now patched (it was setting the default level to DEBUG), and now I'm not getting debug output by default.

David M. Karr
  • 14,317
  • 20
  • 94
  • 199