PDA

View Full Version : Log corruption?


shafjac
02-04-2004, 10:27 AM
It appears that one of the steps in my build process is corrupting my log file. The manifestation of this corruption is that this step does not get completely logged, and all the XML in the document before this step is deleted.

In this case, I have it running as the first step in my build process. It is a "Set Macro" action, the name of the macro is "BUILDFOLDER" and the value for it is the following:
["%BUILDROOT%\" & Year(Now) & "-" & vbld_PadLeft(CStr(Month(Now)), 2, "0") & "-" & vbld_PadLeft(CStr(Day(Now)), 2, "0") & " " & vbld_PadLeft(CStr(Hour(Now)), 2, "0") & vbld_PadLeft(CStr(Minute(now)), 2, "0")]

The beginning of my log file output is:
[ BLANK LINE ]
<status code='0'>Completed</status>
</step>

There's no XML declaration, no <log> element, no start <step> tag, nothing before that.

This becomes a big problem when I try to transform the XML document via HTML because the parser can't load it and thus can't transform it.

I've tried moving this step further along in the build process, and when I do that, it still deletes all the text above it in the log file. I've also tried logging to a text file instead of an XML file, and it still doesn't log this step (I'd really prefer XML anyway). I've tried turning off logging for this step (using Logging.bld as an example), and that doesn't seem to do anything.

Does anyone have any ideas?

kinook
02-04-2004, 11:19 AM
It sounds like the log file is getting changed during the build. Can you provide a simple repro case? Please send

1) The info from Help | About | Install Info
2) The contents of the file listed at Tools | File Locations | Application Options
3) A .bld file that demonstrates the problem.

Thanks.

shafjac
02-04-2004, 11:34 AM
Thanks for the quick response. Here's my info:

1) The info from Help | About | Install Info

Visual Build Professional 5.2
Evaluation Version: 53 uses remaining
Windows Version: 5.1.2600.1.0
Install path: C:\Program Files\VisBuildPro
cmax20u.dll version 2.1.0.21
SftTree_IX86_U_45.dll version 4.5a
unins000.exe version 51.9.0.0
VisBuildBld.dll version 5.2.0.2
VisBuildCmd.exe version 5.2.0.4
VisBuildCore.dll version 5.2.0.3
VisBuildDotNET.dll version 5.2.0.5
VisBuildExt.dll version 5.2.0.5
VisBuildLog.dll version 5.2.0.4
VisBuildMisc.dll version 5.2.0.3
VisBuildMS.dll version 5.2.0.2
VisBuildNet.dll version 5.2.0.3
VisBuildPro.exe version 5.2.0.6
VisBuildSvr.dll version 5.2.0.4

2) The contents of the file listed at Tools | File Locations | Application Options

<?xml version='1.0'?>
<configuration>
<option name='CaseSensitiveBuildRuleComparisons'>0</option>
<option name='DefaultScriptEngine'>VBScript</option>
<option name='DelLogFileOnBuild'>1</option>
<option name='DelTempMacrosAfterBuild'>1</option>
<option name='EnvVarsInSystemMacros'>1</option>
<option name='LogDefaultStepProperty'>0</option>
<option name='LogFilename'>C:\Documents and Settings\All Users\Application Data\Kinook Software\Visual Build Professional\VisBuildPro.log</option>
<option name='LogFormat'>XML</option>
<option name='NestBuildRules'>1</option>
<option name='NestIncludeInBuild'>1</option>
<option name='PersistBuildStatus'>0</option>
<option name='ReevaluateAllBuildRules'>0</option>
<option name='SetProjectDirectory'>0</option>
<option name='StripLogLinefeedChar'>0</option>
</configuration>

3) A .bld file that demonstrates the problem.

See attached.

kinook
02-04-2004, 01:44 PM
The first step of the project sets the BUILDFOLDER macro, which is referenced by the project LOGFILE macro (%BUILDFOLDER%\BuildLog.xml), so the log file is getting changed by that step. With XML logging, you can't change the log file during a build, since that will leave you with two partial XML documents.

You safely can change the log file before the build starts in the project's vbld_BuildStarting event. The attached modified sample demonstrates this (to view the code, go to View | Script Editor | Project tab). The sample stores the macro as a temporary macro (which overrides the project macro) rather than a project macro so that the project does not get modified (which would result in the GUI prompting to save changes at the end of the build).

The Logging FAQ http://www.kinook.com/Forum/forumdisplay.php?forumid=15 also has information that may be helpful.

shafjac
02-04-2004, 04:24 PM
Beautiful! I added your pre-build script, and that fixed the problem.

Thanks for the prompt resolution.