Logging an XML in logActivityMessages

I am trying to log to the service audit database an XML message using the pub.prt.log:logActivityMessages service. I don’t know how to specify the XML string in the input to this service (e.g. FullMessage) so that the tags are not rendered. I was trying to put sth like <plaintext>%xmldata%</plaintext>. However the closing PLAINTEXT tag is ignored when displayed in Monitor and my xmldata appears followed by the HTML source of the page.

Can anyone suggest how to log XML using the logActivityMessages so that the XML is correctly displayed in Monitor?

Any help appreciated.

Looks like either I have posted something dumb or nobody tried this so far.
Anyway I have found the solution if anyone was interested…
I am replacing the character > with > and < with <. Then I enclose the string in the PRE tags and I log it to the Audit database using the logActivityMessages. Then when I display the service in the Monitor web GUI the XML is displayed correctly.

have you tried using encode feature of recordToDocument?

I am not using the pub.web:recordToDocument because it is deprecated. I use pub.xml:documentToXMLString instead. It also has the encode input and I have just checked both cases, true and false. The same XML string is generated in both cases, so I don’t really understand what the parameter was supposed to do. In any case if I just log the generated XML to the Audit db then the XML is not displayed correctly in Monitor.

Would HTMLEncode not give you the result that you are trying to achieve?

No, if I use true or false for the encode parameter the xmldata string generated by the service is exactly the same.