Debugging Open Data Tables and YQL Network Calls

To aid in your debugging efforts, YQL provides the option to have network-level logging. When enabled, all network requests are uncached, so you can iteratively develop Open Data Tables more easily, as well as debug network requests between YQL and the remote service. Network logs display both the request headers and the response content for each network call.

Note

Network capture stops once YQL encounters a default (built-in) table or table fetched from yql.storage, even if subsequent requests are made using an Open Data Table.

When you enable network-level logging, YQL provides a key within the diagnostics element for each network call that occurs, seen in the following YQL response snippet as id attributes:

The id key can be used within 5 minutes of an execution to see log data.

Enabling Logging

To enable network-level logging, you simply append debug=true to the YQL console URL or API query like this:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.places%20where%20text%3D%22sunnyvale%22%0A&diagnostics=true&debug=true

Viewing Logs

You can access network-level logs within 5 minutes of running a YQL statement or call. You can view the logs using the YQL Console or using the YQL log URL with the query string parameter id. We will discuss the id attribute and then show how to view logs in the following sections.

id Attribute

When you make a request to the YQL Web Service and add the query string parameters diagnostics=true&debug=true, the response will contain diagnostic information that can be used for debugging. In the returned diagnostic information (shown below), you will see a url element that has the id attribute we mentioned earlier.

This id is associated with a log message and is required to view log messages. We will be showing you how to use the id in the next two sections to view logs from the YQL Console and using the YQL Log API.

Note

For both community and built-in tables, if the env parameter is included in the YQL Web Service URL, the id attribute will not be returned in the response. When using community tables, to have the id attribute returned in the response, you must instead include the table with a USE statement.

Using the YQL Console
  1. From the YQL Console, check the Diagnostics and Debug checkboxes, enter your YQL statement, and click TEST.
  2. From the returned response in the FORMATTED tab, click on the value for the id attribute of the url element in the diagnostic information.
  3. A new tab will open showing log data that includes the HTTP request, the HTTP headers, and the raw response.
Using the YQL Log URL
  1. Append the query string debug=true&diagnostics=true to one of the YQL Web service URLs.

    For example: http://query.yahooapis.com/v1/public/yql?q=<your_query_statement>&debug=true&diagnostics=true

  2. Make the HTTP request to the YQL Web service URL with the debug and diagnostics query parameters.
  3. From the returned response, copy the value for the id key provided in the url element of the diagnostics information and append it to the YQL log URL as shown here: http://query.yahoo.com/v1/logging/dump?id=<id_value>
  4. You will be returned the dumped log data that includes the HTTP request, the HTTP headers, and the raw response.

Table of Contents