How to display total time per build target in Phing output

268 views Asked by At

In my build.xml I have a main build target which is composed of several targets. I need to check how much time takes to run those targets. Currently in my output console, I only see TOTAL TIME for the build. Is there a way to show times for internal targets?

2

There are 2 answers

0
Jakub Filipczyk On BEST ANSWER

It's quite straight forward.

  1. Create your logger class which extends phings DefaultLogger
  2. Use event listener method targetStarted to store start timestamp
  3. Use event listener method targetFinished to calculate elapsed time and print it to output stream
  4. Use the logger by using command line attribute -logger f.e. to use lib/loggers/MyLogger.php call: phing -logger lib.loggers.MyLogger
0
Grzegorz Krauze On

If you want to print execution times of subtargets just use:

$phing <target> -logger phing.listener.TargetLogger