What I'm trying to achieve is to have log4j as the only output from my Ant build file.
Getting log4j works pretty much perfectly except that it extends Ants output. So I'm getting Ant's DefaultLogger interspersed with log4j output. Take a VERY simple Ant build file:
<project name="Maintenance_to_Delivery" default="main" basedir=".">
<target name="main">
<echo message="test">
</target>
</project>
And log4j.properties
log4j.rootLogger=ERROR, stdout
log4j.logger.org.apache.tools.ant.Project=INFO
log4j.logger.org.apache.tools.ant.Target=INFO
log4j.logger.org.apache.tools.ant.taskdefs=INFO
log4j.logger.org.apache.tools.ant.taskdefs.Echo=INFO
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss} %-5p %m%n
log4j.appender.stdout.Threshold=INFO
And running this plus the output:
# ant -lib /app/apache-sf/log4j/1.2.16/log4j-1.2.16.jar:. -listener org.apache.tools.ant.listener.Log4jListener
Buildfile: /home/sysswb/working/qa/sep/M2D-new/build.xml
16:36:59 INFO Build started.
main:
16:37:00 INFO Target "main" started.
[echo] TEST
16:37:00 WARN TEST
16:37:00 INFO Target "main" finished.
BUILD SUCCESSFUL
Total time: 1 second
16:37:00 INFO Build finished
so - is it possible to get log4j to completely replace the DefaultLogger output? ...without writing a custom logger? Since the -listener argument registers extra listeners, can whatever listener the DefaultLogger uses be removed/disabled?
I'm just Java 1.6.0_18 and Ant 1.8.0. TIA.