ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: How to echo date-time to log file?
Date Tue, 14 Sep 2004 14:56:02 GMT
On Tue, 14 Sep 2004, Vadim Kazakov <> wrote:

> You could use the new macrodef task to create a macro instead of
> using antcall

Yes, but keep in mind that you'll have to use a different property
name in each invocation that way since the first invocation will set
the property "logtime" and subsequent invocations won't override it.

<antcall> gets around this by using a separate property context with
the new subbuild.

<macrodef name="logWithTimestamp">
  <attribute name=logFile"/>
  <attribute name=message"/>
      <format property="logtime.@{logFile}.@{message}" 
              pattern="yyyy.MM.dd ':' HH:mm:ss z"/>
    <echo file="${logFile}" append="true">${logtime.@{logFile}.@{message}} :: ${message}</echo>

will work if you never try to log the same message to the same file
twice inside the same build.  Otherwise you'll have to come up with a
smarter property name generation algorithm.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message