Troubleshooting

    Note

    If you are sharing debug output on any public medium such as our IRCchannel or an issue tracker using Pastebin, Github Gists or a similarservice, make sure to remove your credentials and any other data youconsider private from the output.

    Libcloud has a special debug mode which when enabled, logs all the outgoingHTTP requests and all the incoming HTTP responses. Output also includes cURLcommands which can be used to re-produce the requests.

    To make the debugging easier, Libcloud will also automatically decompress theresponse body (if compressed) before logging it.

    To enable it, set environment variable and make it pointto a file where the debug output should be saved.

    If the API returns JSON or XML in the response body which is not humanfriendly, you can also set environment variable which will cause the JSON or XML to be beautified/ formated so it’s easier for humans to read it. Keep in mind that thisonly works for non-chunked responses.

    Example output:

    1. # -------- begin 4431824872 request ----------
    2. curl -i -X GET -H 'Host: s3.amazonaws.com' -H 'X-LC-Request-ID: 4431824872' -H 'Content-Length: 0' -H 'User-Agent: libcloud/0.6.0-beta1 (Amazon S3 (standard))' 'https://s3.amazonaws.com:443/?AWSAccessKeyId=foo&Signature=bar'
    3. # -------- begin 4431824872:4431825232 response ----------
    4. HTTP/1.1 200 OK
    5. X-Amz-Id-2: 1234
    6. Server: AmazonS3
    7. Transfer-Encoding: chunked
    8. X-Amz-Request-Id: FFFFFFFFFF
    9. Date: Tue, 01 Nov 2011 22:29:11 GMT
    10. Content-Type: application/xml
    11.  
    12. 171
    13. <?xml version="1.0" encoding="UTF-8"?>
    14. <ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Owner><ID>sada8932dsa8d30i</ID><DisplayName>kami</DisplayName></Owner><Buckets><Bucket><Name>test34324323</Name><CreationDate>2011-11-01T22:17:23.000Z</CreationDate></Bucket></Buckets></ListAllMyBucketsResult>
    15. 0
    16.  
    17. # -------- end 4431824872:4431825232 response ----------

    Example 2 - Making JSON / XML response human friendly

    Non-formatted JSON response:

    1. LIBCLOUD_DEBUG=/dev/stderr python my_script.py

    Human friendly formatted JSON response:

    1. LIBCLOUD_DEBUG=/dev/stderr LIBCLOUD_DEBUG_PRETTY_PRINT_RESPONSE=1 python my_script.py
    1. # -------- begin 41102928:41133624 response ----------
    2. HTTP/1.1 200 OK
    3. Content-Length: 1572
    4. X-Compute-Request-Id: req-3ce8b047-55cd-4e20-bfeb-b65619696aec
    5. Server: nginx/1.4.7
    6. Connection: keep-alive
    7. Date: Sat, 06 Sep 2014 14:14:38 GMT
    8. Content-Type: application/json
    9.  
    10. {
    11. "servers": [
    12. {
    13. "OS-DCF:diskConfig": "MANUAL",
    14. "OS-EXT-AZ:availability_zone": "nova",
    15. "OS-EXT-STS:power_state": 1,
    16. "OS-EXT-STS:vm_state": "active",
    17. "OS-SRV-USG:launched_at": "2014-09-06T14:13:32.000000",
    18. "OS-SRV-USG:terminated_at": null,
    19. "accessIPv4": "",
    20. "accessIPv6": "",
    21. "addresses": {
    22. "internet-routable": [
    23. {
    24. "OS-EXT-IPS-MAC:mac_addr": "fa:16:3e:3f:c0:a1",
    25. "OS-EXT-IPS:type": "fixed",
    26. "addr": "10.100.100.101",
    27. "version": 4
    28. }
    29. ]
    30. },
    31. "config_drive": "",
    32. "created": "2014-09-06T14:13:12Z",
    33. "flavor": {
    34. "id": "90c2a137-611b-4dd2-9d65-d4a0b0858531",
    35. "links": [
    36. {
    37. "href": "http://nova/d3b31ebfd32744d19d848f3e9c351869/flavors/90c2a137-611b-4dd2-9d65-d4a0b0858531",
    38. "rel": "bookmark"
    39. }
    40. ]
    41. },
    42. "hostId": "561d56de25c177c422278d7ca5f8b210118348040b12afbad06f278a",
    43. "id": "deb35f96-be41-431e-b931-6e615ec720f4",
    44. "image": {
    45. "id": "e9537ddd-6579-4473-9898-d211ab90f6d3",
    46. "links": [
    47. {
    48. "href": "http://nova/d3b31ebfd32744d19d848f3e9c351869/images/e9537ddd-6579-4473-9898-d211ab90f6d3",
    49. "rel": "bookmark"
    50. }
    51. ]
    52. },
    53. "links": [
    54. {
    55. "href": "http://nova/v2/d3b31ebfd32744d19d848f3e9c351869/servers/deb35f96-be41-431e-b931-6e615ec720f4",
    56. "rel": "self"
    57. },
    58. {
    59. "href": "http://nova/d3b31ebfd32744d19d848f3e9c351869/servers/deb35f96-be41-431e-b931-6e615ec720f4",
    60. "rel": "bookmark"
    61. }
    62. ],
    63. "metadata": {},
    64. "name": "test lc 2",
    65. "os-extended-volumes:volumes_attached": [],
    66. "progress": 0,
    67. "security_groups": [
    68. {
    69. "name": "default"
    70. }
    71. ],
    72. "status": "ACTIVE",
    73. "tenant_id": "d3b31ebfd32744d19d848f3e9c351869",
    74. "updated": "2014-09-06T14:13:32Z",
    75. "user_id": "06dda7c06aa246c88d7775d02bc119ac"
    76. }
    77. ]
    78. }
    79. # -------- end 41102928:41133624 response ----------
    1. # -------- begin 33145616:33126160 response ----------
    2. HTTP/1.1 200 OK
    3. X-Amzn-Requestid: e84f62d0-368e-11e4-820b-8bf013dc269e
    4. Date: Sun, 07 Sep 2014 13:00:13 GMT
    5. Content-Length: 457
    6. Content-Type: text/xml
    7.  
    8. <?xml version="1.0"?>
    9. <ListHostedZonesResponse xmlns="https://route53.amazonaws.com/doc/2012-02-29/"><HostedZones><HostedZone><Id>/hostedzone/Z14L0C73CHH1DN</Id><Name>example1.com.</Name><CallerReference>41747982-568E-0DFC-8C11-71C23757C740</CallerReference><Config><Comment>test</Comment></Config><ResourceRecordSetCount>9</ResourceRecordSetCount></HostedZone></HostedZones><IsTruncated>false</IsTruncated><MaxItems>100</MaxItems></ListHostedZonesResponse>
    10. # -------- end 33145616:33126160 response ----------

    Human friendly formatted XML response: