sopel / botocross

A Python package for operating cross region AWS resources
Other
4 stars 4 forks source link

[Feature] Include boto HTTP requests logging when setting loglevel to DEBUG #23

Closed mrdavidlaing closed 11 years ago

mrdavidlaing commented 11 years ago

When calling a botocross command with the --log-level option set to DEBUG, it would be good if this included details of the HTTP requests being made by boto.

According to this blog post, this is as simple as adding:

import logging
logging.basicConfig(filename="boto.log", level=logging.DEBUG)

to the "top" of the botocross scripts.

Giving verbose output like:

POST
/
Action=GetUser&Version=2010-05-08
host:iam.amazonaws.com
x-amz-date:20121106T224413Z

<GetUserResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/">
  <GetUserResult>
    <User>
      <UserId>AIDAJYJES6HZxxxxxxx</UserId>
      <Path>/</Path>
      <UserName>backup-agent</UserName>
      <Arn>arn:aws:iam::49758xxxx:user/backup-agent</Arn>
      <CreateDate>2012-11-06T14:09:33Z</CreateDate>
    </User>
  </GetUserResult>
  <ResponseMetadata>
    <RequestId>7d534adc-2863xxxxxxx</RequestId>
  </ResponseMetadata>
</GetUserResponse>
sopel commented 11 years ago

@mrdavidlaing - #30 (just the commit referenced above) extends the default stdout logging to boto as well, which is automatically included in all scripts and sensitive to the --log argument like so.

While separation of log streams might be desired in special cases, this would be sufficient for me right now (and also be in line with the respective common pattern as e.g. outlined in http://www.12factor.net/logs).

In case you agree, this issue could be resolved, otherwise we'd need to find a pragmatic solution for orchestrating the two log streams separately without just duplicating the existing code per log stream.

sopel commented 11 years ago

Given the feature as such is implemented (i.e. boto HTTP requests are logged to the console), I'm closing this for now - a separation of boto/botocross log streams can be addressed via a separate issue if need be.