> It did come from the docs...
> 
> It's just REALLY badly documented HOW to do it!

that was the problem. I could find the functions I needed, but no background
on HOW to use them.

here's the code I ended up with, in case anyone wants a simple way of
trapping and archiving app errors with <cferror>

<cflock name="errorlock" timeout="5" throwontimeout="Yes" type="exclusive">
        <cfif fileexists(expandpath('errors.xml'))>
                <cffile action="READ" 
                file="#expandpath('errors.xml')#" 
                variable="errorfile">
        <cfelse>
                <cfset errorfile = "">
        </cfif>
</cflock>

<cfscript>
if (len(trim(errorfile))) {
        errorpacket = xmlparse(errorfile);
} else {
        errorpacket = xmlnew();
        errorpacket.xmlRoot = xmlelemnew(errorpacket, "incidents"); 
}
newElemPos = arraylen(errorpacket.incidents.xmlchildren)+1;
errorpacket.incidents.xmlchildren[newElemPos] = xmlElemNew(errorpacket,
"error");
errorpacket.incidents.xmlchildren[newElemPos].xmlchildren[1] =
xmlElemNew(errorpacket, "date");
errorpacket.incidents.xmlchildren[newElemPos].xmlchildren[1].xmltext =
now();
errorpacket.incidents.xmlchildren[newElemPos].xmlchildren[2] =
xmlElemNew(errorpacket, "referer");
errorpacket.incidents.xmlchildren[newElemPos].xmlchildren[2].xmltext =
xmlformat(error.httpreferer);
errorpacket.incidents.xmlchildren[newElemPos].xmlchildren[3] =
xmlElemNew(errorpacket, "diagnostics");
errorpacket.incidents.xmlchildren[newElemPos].xmlchildren[3].xmltext =
xmlformat(error.diagnostics);
</cfscript>


<cflock name="errorlock" timeout="5" throwontimeout="Yes" type="exclusive">
        <cffile action="WRITE" file="#expandpath('errors.xml')#" 
        output="#tostring(errorpacket)#" 
        addnewline="No"> 
</cflock>

> -----Original Message-----
> From: Paul Johnston [mailto:[EMAIL PROTECTED]
> Sent: 16 July 2003 11:14
> To: [EMAIL PROTECTED]
> Subject: RE: [ cf-dev ] adding elements to xml packets
> 
> 
> It did come from the docs...
> 
> It's just REALLY badly documented HOW to do it!
> 
> > heh. how queer!
> > 
> > Paul's method works well.
> 
> Now please... Let's at least assume that I can get it right sometimes!
> 
> :D
> 
> Paul
> 
> 
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
> 


-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to