You would think it's an easy task to profile your build, but Ant authors simply neglected this feature.
In order to timestamp each step, do this way:
1) create a log4j.properties file and put it in the classpath:
# Set root category priority to INFO and its only appender to CONSOLE.
log4j.rootCategory=DEBUG, CONSOLE
#log4j.rootCategory=DEBUG, CONSOLE, LOGFILE
# Set the enterprise logger category to FATAL and its only appender to CONSOLE.
log4j.logger.org.apache.tools.ant=DEBUG, CONSOLE
# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=DEBUG
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n
# LOGFILE is set to be a File appender using a PatternLayout.
log4j.appender.LOGFILE=org.apache.log4j.FileAppender
log4j.appender.LOGFILE.File=axis.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.Threshold=DEBUG
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
2) add to the classpath the log4j.jar file
3) run:
set ANT_OPTS=-Dlog4j.debug -Dlog4j.configuration=file:./log4j.properties
ant -listener org.apache.tools.ant.listener.Log4jListener -verbose -buildfile mybuild.xml build
Terrible, eh?
Thursday, February 25, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment