Ticket #255 (closed enhancement: fixed)
Timestamp in Phing Properties for Echo etc
| Reported by: | normk | Owned by: | hans |
|---|---|---|---|
| Priority: | minor | Milestone: | 2.3.1 |
| Component: | phing-core | Version: | 2.3.1RC1 |
| Keywords: | timestamp, echo | Cc: |
Description
Feature request: If possible, provide a timestamp, i.e., formatted Date/Time stamp in phing built in properties for display in <echo> task. This will provide a checkpoint for an appended log file that you can use when you run phing from CRON and >> log.txt.
For instance, add phing.startTime formatted as standard date/time format in current locale so you can <echo msg="Phing started at ${phing.startTime}" />
I don't really need xinc or cc so I run my nightly phing build from cron and redirect the output to a log file instead of picking up the *nix mail. Using >>, I append each cron run to the log file and examine it periodically.
Thanks for considering this!

Tested this suggested patch to Phing.php. Not sure if it's in the most appropriate place but it makes sense.
After line 1079: self::setProperty('application.startdir', getcwd());
Add: self::setProperty('phing.startTime', gmdate('D, d M Y H:i:s', time()) . ' GMT');
Tested with this xml build file: <?xml version="1.0"?> <project name="FooBar" default="dist" basedir=".">
</project>
Output:
[echo] Phing started on Thu, 19 Jun 2008 22:08:00 GMT