{"id":62,"date":"2008-10-23T18:04:00","date_gmt":"2008-10-23T17:04:00","guid":{"rendered":"http:\/\/jimblackler.com\/blog\/?p=62"},"modified":"2008-10-23T18:06:05","modified_gmt":"2008-10-23T17:06:05","slug":"viewing-raw-xml-traffic-when-using-google-data-java-client-apis","status":"publish","type":"post","link":"https:\/\/jimblackler.com\/?p=62","title":{"rendered":"Viewing raw XML traffic when using Google Data Java Client APIs"},"content":{"rendered":"<p>The Google Data Java Client APIs provide a convenient way for Java prorgams to interface with Google&#8217;s public Data APIs, for Google calendars, contacts, and many other services.<\/p>\n<p>It&#8217;s such a good abstraction, however, there is no clear way of seeing the underlying XML of the feed. When debugging, and for their interest, programmers may wish to see this data &#8211; it&#8217;s supposed to be human-readable after all.<\/p>\n<p>After at least an hour of playing around I found the commands to enable the logging in the client&#8217;s initialization. Traffic will then be output to the console at run time.<\/p>\n<p>The gotcha is that enabling verbose output on Java&#8217;s logging requires not just the logs to be set to Level.ALL, but also the underlying handlers.<\/p>\n<p>Here&#8217;s the code.<\/p>\n<div id=\"ig-sh-1\" class=\"syntax_hilite\">\n\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"java\" style=\"font-family:monospace\"><li><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">import<\/span> <span style=\"color: #006699\">java.util.logging.Logger<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<li><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">import<\/span> <span style=\"color: #006699\">com.google.gdata.client.http.GoogleGDataRequest<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<li><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\"><span style=\"color: #000000;font-weight: bold\">import<\/span> <span style=\"color: #006699\">com.google.gdata.client.http.HttpGDataRequest<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<div id=\"ig-sh-2\" class=\"syntax_hilite\">\n\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"java\" style=\"font-family:monospace\"><li><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">Logger.<span style=\"color: #006633\">getLogger<\/span><span style=\"color: #009900\">&#040;<\/span>Logger.<span style=\"color: #006633\">GLOBAL_LOGGER_NAME<\/span><span style=\"color: #009900\">&#041;<\/span>.<span style=\"color: #006633\">getParent<\/span><span style=\"color: #009900\">&#040;<\/span><span style=\"color: #009900\">&#041;<\/span>.<span style=\"color: #006633\">getHandlers<\/span><span style=\"color: #009900\">&#040;<\/span><span style=\"color: #009900\">&#041;<\/span><span style=\"color: #009900\">&#091;<\/span><span style=\"color: #cc66cc\">0<\/span><span style=\"color: #009900\">&#093;<\/span>.<span style=\"color: #006633\">setLevel<\/span><span style=\"color: #009900\">&#040;<\/span>Level.<span style=\"color: #006633\">ALL<\/span><span style=\"color: #009900\">&#041;<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<li><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">Logger.<span style=\"color: #006633\">getLogger<\/span><span style=\"color: #009900\">&#040;<\/span>GoogleGDataRequest.<span style=\"color: #000000;font-weight: bold\">class<\/span>.<span style=\"color: #006633\">getName<\/span><span style=\"color: #009900\">&#040;<\/span><span style=\"color: #009900\">&#041;<\/span><span style=\"color: #009900\">&#041;<\/span>.<span style=\"color: #006633\">setLevel<\/span><span style=\"color: #009900\">&#040;<\/span>Level.<span style=\"color: #006633\">ALL<\/span><span style=\"color: #009900\">&#041;<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<li><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">Logger.<span style=\"color: #006633\">getLogger<\/span><span style=\"color: #009900\">&#040;<\/span>HttpGDataRequest.<span style=\"color: #000000;font-weight: bold\">class<\/span>.<span style=\"color: #006633\">getName<\/span><span style=\"color: #009900\">&#040;<\/span><span style=\"color: #009900\">&#041;<\/span><span style=\"color: #009900\">&#041;<\/span>.<span style=\"color: #006633\">setLevel<\/span><span style=\"color: #009900\">&#040;<\/span>Level.<span style=\"color: #006633\">ALL<\/span><span style=\"color: #009900\">&#041;<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>The Google Data Java Client APIs provide a convenient way for Java prorgams to interface with Google&#8217;s public Data APIs, for Google calendars, contacts, and many other services. It&#8217;s such a good abstraction, however, there is no clear way of seeing the underlying XML of the feed. When debugging, and for their interest, programmers may [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-62","post","type-post","status-publish","format-standard","hentry","category-general-programming"],"_links":{"self":[{"href":"https:\/\/jimblackler.com\/index.php?rest_route=\/wp\/v2\/posts\/62","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jimblackler.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jimblackler.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jimblackler.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jimblackler.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=62"}],"version-history":[{"count":0,"href":"https:\/\/jimblackler.com\/index.php?rest_route=\/wp\/v2\/posts\/62\/revisions"}],"wp:attachment":[{"href":"https:\/\/jimblackler.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=62"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jimblackler.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=62"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jimblackler.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=62"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}