To code it in org.apache.tools.ant.DefaultLogger, add ...

  + " @ " + formatTime(System.currentTimeMillis() - startTime)

... to the msg being prepared.  Like so ....

    public void targetStarted(BuildEvent event) {
        if (Project.MSG_INFO <= msgOutputLevel
            && !event.getTarget().getName().equals("")) {
            String msg = StringUtils.LINE_SEP
                + event.getTarget().getName() + " @ " + 
formatTime(System.currentTimeMillis() - startTime) + ":";
            printMessage(msg, out, event.getPriority());
            log(msg);
        }
    }

Works sweetly, but we don't want to maintain a forked Ant.

The other solution for us was to launch ant like so :

  ant -verbose -listener org.apache.tools.ant.listener.CommonsLoggingListener 
>&ant-output.txt

The redirection '>&' is out and err to the same log file. That only works on 
Unix. On Windows the >ant-output.txt 2>ant-output.txt causes teh process 
handelr to barf suggesting the file is already in use.

All we wanted was to work out how long each target was taking, without 
switching to an XML logging format..

- Paul


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to