#1
|
|||
|
|||
Text file to log
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! |
#2
|
|||
|
|||
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. |
#3
|
|||
|
|||
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" |
#4
|
|||
|
|||
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. |
#5
|
|||
|
|||
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. |
#6
|
|||
|
|||
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. |
#7
|
|||
|
|||
bump
|
#8
|
|||
|
|||
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. |
|
|