PDA

View Full Version : XML Logging


gribble
12-21-2004, 07:27 PM
Hi, i decided to convert some of my existing build scripts over to use XML logging and an XML Transform step at the end to make it into a HTML document (just using the default xslt stylesheet).

What ive found though, is that when a compile failed, it had the following output:

code\sql\query.h(22) : error C2143: syntax error : missing ';' before '<class-head>'


This being on the log then caused the XML Transform step to fail because it thought the <class-head> was an XML tag when it was actually part of a step's output

Is there anyway i can fix this so i can use XML logging?


Also, is there any way to check/enforce that VBPro has it's log output in Application Options set to XML and not text... say if someone else was to run the buildscript, or on one of our build servers if it happened to be set to log as text not XML... it seems that the log output format should maybe be determined by a given script, and not as an application wide setting... because some scripts may require XML formatted logs while others may just email the raw logfile on completion (assuming it is plain readable text)

kinook
12-22-2004, 03:12 PM
How is the text being written to the log file? VBP's XML logger will normally enclose step output in a CDATA section so that markup chars within it will not be treated as markup (for example, see the attached sample). Please post a stripped down sample which we can build that demonstrates the problem.

To set the log format to XML from your project (before the build starts), call

Application.Options.LogFormat = "XML"

from the project's vbld_BuildStarting script event.

gribble
12-22-2004, 05:01 PM
it's build output from a make visual studio 6 c++ project step

im not sure i can make an example without giving all the source code as well... basically there was an error in one of the c++ files in the the VC6 project and the error message was as above, containing the string <class-head> which is some sort of class or whatever in the c++ file


The XML Transform step at the end of the build gave an error saying that tag <class-head> was unmatched or something. Ill dig up the exact error and post it

Thanks for the tip on ensuring log format

gribble
12-22-2004, 06:20 PM
The exact output and error message from the XML Log Transform step was:

Closing any open log tags...
Loading XML input document...
Error at line 698, position 3 loading 'C:\DOCUME~1\RYAN~1.GRI\LOCALS~1\Temp\bld4EBA.tmp' : End tag 'step' does not match the start tag 'class-head'.


Ive attached the logfile it was trying to transform (renamed to .txt). You can see that the output in question is inside CDATA attribute

kinook
12-22-2004, 06:29 PM
Looking at the log, it appears that you have a Write File action that is writing to the log file (see line 550, column 35). The Write File action simply opens the specified file and appends whatever text is supplied, and if the log file is XML, that isn't going to work. If you want that output in the log file, use a Log Message action rather than a Write File action.

gribble
12-22-2004, 06:30 PM
i just realised that myself!! Converting over to using XML format, seems i missed the WriteFile step that's in the failure steps... should have used a Log Message :D

Thanks for the help