ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Travis Quarterman <trav...@gmail.com>
Subject Re: How to echo date-time to log file? - related question
Date Thu, 16 Sep 2004 13:56:33 GMT
This is trick since the HEADER information differs between files.

- Thanks

On Thu, 16 Sep 2004 09:31:39 -0400, Dick, Brian E. <brian.dick@fmr.com> wrote:
> If you can use a regular expression to tell Ant what the HEADER looks
> like, you may be able to use the regular expression replacement filter
> in the copy task.
> 
> 
> 
> -----Original Message-----
> From: Travis Quarterman [mailto:travisq@gmail.com]
> Sent: Thursday, September 16, 2004 9:11 AM
> To: Ant Users List
> Subject: Re: How to echo date-time to log file? - related question
> 
> So I can't have an Ant task for doing this or do I need to manually
> add this token to each file. Ideally, It would be nice to checkout
> files and place them in a hold area and then have an Ant task as
> mentioned earlier iterate over all the file; appending a VERSION in
> the HEADER of each file.
> 
> - Thanks
> 
> On Thu, 16 Sep 2004 09:01:15 -0400, Dick, Brian E. <brian.dick@fmr.com>
> wrote:
> > Put a @VERSION@ token in each file and use a token replacement filter
> in
> > the copy task.
> >
> >
> >
> > -----Original Message-----
> > From: Travis Quarterman [mailto:travisq@gmail.com]
> > Sent: Thursday, September 16, 2004 8:55 AM
> > To: Ant Users List
> > Subject: Re: How to echo date-time to log file? - related question
> >
> > I am need this very same task! Can this task iterate over a number of
> > files or just one file?  I am wanting to put a $version in a number of
> > files that have been checked out and placed in a staging area, and
> > have a task like this one append in the HEADER of the file a version
> > number.
> >
> > - Thanks
> >
> > On Thu, 16 Sep 2004 07:11:23 -0500, Fox, Cheri <cheri.fox@thomson.com>
> > wrote:
> > > In a related question:  I am trying to echo a version parameter to a
> > file.
> > > <target name="echo.version">
> > >         <echo file="${VERSION.FILE}" append="false">
> > >         ${version}
> > >         </echo>
> > > </target>
> > >
> > > The file is put in a local directory using a vssget command.  I am
> > getting
> > > an error message:
> > >
> > > P:\DeploymentTools\ant\spain_build.xml:73: Following error occured
> > while
> > > executing this line
> > > P:\DeploymentTools\ant\spain_build.xml:156:
> > java.io.FileNotFoundException:
> > > P:\DeploymentTools\SpainWar\WebContent\version.jsp (Access is
> denied)
> > >
> > > I am guessing this occurs because the file is not checked out.  Is
> > there
> > > another way to update this file or is doing a checkout for this file
> > my only
> > > option?
> > >
> > > Cheri
> > > -----Original Message-----
> > > From: Peter Reilly [mailto:peterreilly@apache.org]
> > > Sent: Tuesday, September 14, 2004 10:03 AM
> > > To: Ant Users List
> > > Subject: Re: How to echo date-time to log file?
> > >
> > > Using macrodef instead of antcall will not work here due to the
> > > immutablity of properties.
> > >
> > > If one assumes that all the messages are different one could write a
> > macro
> > > like:
> > >
> > > <macrodef name="timestamp">
> > >    <attribute name="file"/>
> > >    <attribute name="message"/>
> > >    <sequential>
> > >      <tstamp>
> > >        <format property="logtime-@{message}" pattern="yyyy.MM.dd :
> > > HH:mm:ss z"/>
> > >      </tstamp>
> > >      <echo file="@{logfile}" message="${logtime-@{message}} ::
> > > @{message}" append="yes"/>
> > >    </sequential>
> > > </macrodef>
> > >
> > > but it would be more clear and correct to use a local property:
> > > (see http://issues.apache.org/bugzilla/show_bug.cgi?id=23942)
> > >
> > > <macrodef name="timestamp">
> > >    <attribute name="file"/>
> > >    <attribute name="message"/>
> > >    <sequential>
> > >      <local name="logtime"/>
> > >      <tstamp>
> > >        <format property="logtime" pattern="yyyy.MM.dd : HH:mm:ss
> z"/>
> > >      </tstamp>
> > >      <echo file="@{logfile}" message="${logtime} :: @{message}"
> > > append="yes"/>
> > >    </sequential>
> > > </macrodef>
> > >
> > > Peter
> > >
> > > Vadim Kazakov wrote:
> > >
> > > >You could use the new macrodef task to create a macro instead of
> > using
> > > >antcall
> > > >
> > > >-----Original Message-----
> > > >From: Daniels, Doug [mailto:Doug.Daniels@gdc4s.com]
> > > >Sent: September 14, 2004 8:24 AM
> > > >To: Ant Users List
> > > >Subject: RE: How to echo date-time to log file?
> > > >
> > > >Here's an idea:
> > > >
> > > >You create a target in your build file called TimeStamp. Then to
> use
> > > >this task you make <antcall..>'s to it and pass in the LogFile, and
> > the
> > > >Message properties to it. This allows you to have a generic logging
> > > >timestamp task that can log messages to files with a timestamp.
> > > >
> > > >Maybe someone has an idea of extending this, using macrodef, or
> > > >whatever, I haven't really looked at that part of ant yet. Here is
> an
> > > >example build file to give you an idea of how it can be used:
> > > >
> > > ><project default="buildPartX">
> > > >
> > > >
> > > >       <target name="timestamp">
> > > >
> > > >
> > > >               <tstamp>
> > > >
> > > >                       <format property="logtime"
> pattern="yyyy.MM.dd
> > > >':' HH:mm:ss z" />
> > > >
> > > >               </tstamp>
> > > >
> > > >               <echo file="${LogFile}" message="${logtime} ::
> > > >${Message}" append="true" />
> > > >
> > > >       </target>
> > > >
> > > >
> > > >       <target name="buildPartX">
> > > >
> > > >               <!-- Define various log files to log to -->
> > > >               <property name="BuildLog" value="build.log"/>
> > > >               <property name="OtherLog" value="other.log"/>
> > > >
> > > >               <!--Do some work then print message with time -->
> > > >
> > > >               <antcall target="timestamp">
> > > >                       <param name="LogFile" value="${BuildLog}"/>
> > > >                       <param name="Message" value="I just finished
> > > >this part of the build" />
> > > >               </antcall>
> > > >
> > > >
> > > >               <!-- Do some more work and print another message to
> a
> > > >different log -->
> > > >               <sleep seconds="2"/>
> > > >
> > > >               <antcall target="timestamp">
> > > >                       <param name="LogFile" value="${OtherLog}"/>
> > > >                       <param name="Message" value="I just finished
> > > >another part of the build" />
> > > >               </antcall>
> > > >
> > > >       </target>
> > > >
> > > ></project>
> > > >
> > > >
> > > >
> > > >-----Original Message-----
> > > >From: Patrick Surry [mailto:Patrick.Surry@quadstone.com]
> > > >Sent: Tuesday, September 14, 2004 9:10 AM
> > > >To: Ant Users List
> > > >Subject: How to echo date-time to log file?
> > > >
> > > >
> > > >""
> > > >
> > > >This seems like a stupid question (and probably is!) but I can't
> seem
> > to
> > > >find
> > > >what I'm looking for anywhere obvious.  I have a build that takes a
> > long
> > > >time,
> > > >and would like to be able to record the current date/time at
> various
> > > >points
> > > >throughout the build.  Just like you get when you run in 'verbose'
> > mode
> > > >but
> > > >without all the extra verbosity.  Ideally I'd want something like a
> > > >'timestamp'
> > > >attribute in the echo task, so I could do things like:
> > > >
> > > ><echo timestamp="true" message="Starting job..."/>
> > > >...
> > > ><echo timestamp="true" message="Finished job."/>
> > > >
> > > >Are there any obvious solutions to this - running an exec with a
> > 'time'
> > > >command
> > > >seems like a hack, <tstamp/> doesn't really do what I want; the
> > > >ant-contrib
> > > ><stopwatch/> doesn't give absolute times, just differences; the
> > > ><record/> task
> > > >probably could change log verbosity to force ant-generated
> timestamps
> > at
> > > >
> > > >different points but again seems roundabout/overkill.
> > > >
> > > >Patrick
> > > >
> > >
> >---------------------------------------------------------------------
> > > >To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > >For additional commands, e-mail: user-help@ant.apache.org
> > > >
> > > >
> > > >
> > >
> >---------------------------------------------------------------------
> > > >To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > >For additional commands, e-mail: user-help@ant.apache.org
> > > >
> > > >
> > >
> >---------------------------------------------------------------------
> > > >To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > >For additional commands, e-mail: user-help@ant.apache.org
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail: user-help@ant.apache.org
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail: user-help@ant.apache.org
> > >
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message