Figured it out...
StringWriter stringWriter = new StringWriter();
XmlWriter xmlWriter = new XmlWriter(stringWriter, "UTF-8");
contactFeed.generate(xmlWriter, contactsService.getExtensionProfile());
log.warn("XML:\n" + stringWriter.toString());
On Saturday, July 28, 2012 9:26:02 AM UTC-5, Burton Rhodes wrote:
> For logging purposes I would like to print out the xml generated by a
> ContactFeed class (batch request) when an error is generated (specifically
> a BatchInterruptedException exception). How is this done?
>
> For example - what would I put at the last line?
>
> [code]
> try {
>
> // Make batch "update" request
> contactsService.batch(new URL("
> https://www.google.com/m8/feeds/contacts/default/full/batch"),
> contactFeed);
> } catch (BatchInterruptedException bie) {
> // Log error
> log.warn("Error processing batch request.", bie);
>
> // Log xml from the request
> log.warn("Request XML:" + [****WHAT DO I PUT HERE?***]);
> }
> [/code]
>
> The reason I would like this is because the error message below is not
> helpful without the full XML.
>
> com.google.gdata.client.batch.BatchInterruptedException: Batch Interrupted
> (some operations might have succeeded) : [Line 1, Column 24075, element
> gd:city] Missing required text content.
>
--
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/contacts/community/forum.html