View Full Version : Text file to log
ftrocchia
04-28-2006, 09:07 AM
Hi.
What I am trying to do is copy the contents of a text file into the build log. We have a third party process that generates a text file, and I need it to be in the log.
Any suggestions?
Thanks!
modernrocketry
04-28-2006, 10:22 AM
Couple of thoughts:
1. Use the DOS command type in a build step
for example: type myfile.txt
2. Use a VBscript to output to the build log
for example:
in a "Run Script" step use VBscript to output each line using Builder.LogMessage
Perhaps the mighty Kinook Admin will have a better suggestion.
kinook
04-28-2006, 10:39 AM
If you're calling the third party process from a Run Program step, choose 'A file' on the Program tab and enter the filename there.
Or
1) Use a script expression like this in a Log Message action:
[vbld_GetFileContents("c:\path\to\file.ext")]
or
[vbld_GetFileContents("%FILE_TO_READ%")]
(if the filename is in macro). Demonstrated in the XML.bld, Advanced.bld, and Script.bld samples.
http://www.visualbuild.com/Manual/scriptexpressions.htm
http://www.visualbuild.com/Manual/sysscriptfile.htm
2) From a Run Script action:
Builder.LogMessage vbld_GetFileContents("c:\path\to\file.ext")
3) From a Run Program action:
%DOSCMD% type "c:\path\to\file.ext"
ftrocchia
04-28-2006, 11:40 AM
Thanks! Worked like a charm.
My next questions is related to the log file. Is there a way to clear the log file?
In my build process I am building, then sending the log in an email. After this I need to continue building and sending a different email. I don't want the first part to be in the log that is sent for the second part.
kinook
04-28-2006, 02:14 PM
If you're using text logging format, just delete the file. For instance, in a Run Program step:
%DOSCMD% del "%LOGFILE%"
For XML format, that won't work since it won't be a valid XML file if you delete it mid-build. You may want to put the 2nd part of the build in a separate project (which uses a different log file) and call from the first with a VisBuildPro Project action.
ftrocchia
05-01-2006, 12:40 PM
I've started using the delete command mentioned in the previous post, and it seems to be working for the most part.
The problem I am having is that it appears the file didn't get deleted, it is just being overwritten.
The third step in my process is shorter, so when I look at the logs I am seeing the third step logging, and then it ends, and then I see the rest of the 2nd step.
ftrocchia
05-16-2006, 08:12 AM
bump
kinook
05-16-2006, 01:10 PM
It's not clear to me exactly what you mean. Please ZIP and post or send:
1) The info from Help | About | Install Info
2) A reproducible test case -- .bld file(s) that reproduce the problem and can be built here
3) A detailed description of the behavior you get vs. the expected behavior
Thanks.
vBulletin® v3.8.11, Copyright ©2000-2024, vBulletin Solutions Inc.