PDA

View Full Version : Xml logging problem


Andrew
03-04-2005, 08:22 AM
Our build procedure consists off one master build file that will call child build files when needed. The logging is turned on and set to XML type. We would like to log to one file instead of one log file per build file.

Everything works ok but when a call is made from a build file to a child build file the logging gets confused. As you can see the step Steps calls a child project file. And the log continues to log messages. The problem is that no closeing tag is added for the <build> entry.

Is my assesment correct? If so how can I fix this?



<step action='VisBuildPro Project' type='0' start='4/03/2005 13:57:48'>
<name>Steps</name>

<build context='GUI' start='4/03/2005 13:57:50'>
<name>\\SRVTCMT001\Build$\Installation\VisualBuildPro\st eps.bld</name>
<step action='Group' type='0' start='4/03/2005 13:57:52'>
<name>Step initialize</name>
<status code='0'>Completed</status>
</step>

kinook
03-04-2005, 08:39 AM
You should get a valid XML document with nested build elements and all closing tags. Testing here, I configured VBP to log globally to %TEMP%\test.xml (at Tools | Application Options | Logging), then opened the Chain.bld sample, unchecked all steps except the first one, built the project, and got the attached xml log file. Do you get the same behavior? Which version of VBP are you running?

Andrew
03-07-2005, 08:16 AM
It seemed I was changeing the log in the very first steps, and it was writing the heading to the old log file instead of the new one.

The chain sample worked like it should work.

I've solved this now but I stumbled on another problem. I now build to a buildxml.log and delete this log file efore I start building.

When an error occures during on a step, within a group. I call a global error handeling function. This will copy the buildxml.log file to a new logfile yyyymmdd_hhmm.xml.

Next I call a transform XML log but this always fails with the error:


Error at line 6, position 3 loading 'C:\DOCUME~1\Build\LOCALS~1\Temp\bldB18.tmp': End tag 'step' does not match the start tag 'build'.


I have to option close input log file xml tags checked

PS: I'm using vbp 5.7

kinook
03-07-2005, 09:11 AM
See the Logging.bld sample for how to delete the log file at the start of a build (must be done from the vbld_BuildStarting event [this fires before the log file is written to]). You could do something similar to change the log filename (by assigning a LOGFILE temp macro) there if necessary.

On the 2nd issue, please post or send to support@kinook.com a reproducible test case demonstrating the problem. Thanks.

Andrew
03-10-2005, 04:16 AM
I've since found the problem and it's due to the way the log file is created.

When an error occures, the vbp project was trying to mail the logfile. The trouble is that these steps are also logged (this can be turned of like in the logging sample). And this would result in steps that are not closed correctly.

On top of this I was switching to a diffrent log file to log only a few steps. I guess I was confusing myself here.

kinook
03-10-2005, 07:29 AM
To send the log file from a build, use a Transform XML Log step (before the Send Mail step). If you clear out the stylesheet field, it will just copy the log file and close any missing tags on the copy. Then send the output file from that step instead of the actual logfile itself (whose tags won't get closed until the build has actually completed). This is also demonstrated in the Logging.bld sample.

Andrew
03-10-2005, 07:33 AM
Thanks for the anwser, and I discoverd this myself. The trouble is that the last few steps that come after the logging are (naturally) not logged and the logfile isn't finished.

So I decided to send the log after the complete build has run.