You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Robert Mark <ro...@gmail.com> on 2013/04/10 10:01:43 UTC

Controlling log4j output from ant

Hi All,

I am having trouble controlling the output from ant to log4j. This is my
log4j2.xml:

<?xml version="1.0" encoding="UTF-8"?>
<configuration status="debug">
   <appenders>
      <Console name="CONSOLE" target="SYSTEM_OUT">
         <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
      </Console>
      <File name="LOGFILE" fileName="log/helloWorld.log">
         <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
      </File>
      <Asynch name="ASYNC">
         <appender-ref ref="LOGFILE"/>
         <appender-ref ref="CONSOLE"/>
      </Asynch>
   </appenders>
   <loggers>
      <root level="info">
         <appender-ref ref="ASYNC"/>
      </root>
   </loggers>
</configuration>

And this is my build.xml:

<project default="helloWorld">
    <target name="helloWorld">
        <echo message="Hello World"/>
    </target>
</project>

The build.xml outputs one line, the logger is set to INFO.. but I see 87
lines of output in my log (only 14 lines of which appear to be INFO)!

http://pastebin.com/6LMxLTge

What have I missed that lets all those DEBUGs come through?

I also posted this yesterday on
http://stackoverflow.com/questions/15901173/controlling-log4j-output-from-ant
.

Thanks for any assistance!

Rob
:)