ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Solofnenko" <trel...@gmail.com>
Subject Re: Can DefaultLogger record the time on each target transition?
Date Thu, 10 Aug 2006 00:27:54 GMT
Have you tried 2>&1 redirection?

- Alexey.

On 8/9/06, Paul Hammant <paul@hammant.org> wrote:
>
>
> 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: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>


-- 
Alexey N. Solofnenko trelony at gmail.com
home: http://trelony.cjb.net/
Pleasant Hill, CA (GMT-8 hours usually)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message