dheerajrajjak / google-api-python-client

Automatically exported from code.google.com/p/google-api-python-client
0 stars 0 forks source link

Send httplib2 logging to the apiclient logger #149

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Problem: example code for low level debugging of google-api-python-client has 
us set the httplib2.debuglevel property. The problem with this is that httplib2 
prints it's log statements, which doesn't work well in production settings or 
in test case frameworks.

Suggestion: capture httplib2 stdout and send it to apiclient's logger. Consider 
using a per-thread sys.stdout capture technique such as 
http://stackoverflow.com/questions/3029816/how-do-i-get-a-thread-safe-print-in-p
ython-2-6

What steps will reproduce the problem?
1. Set httplib2.debuglevel
2. Run some operations
3. Try to capture logs from STDERR or from api client's logger
4. BUG: httplib2 logging goes to STDOUT

What is the expected output? What do you see instead?

It would be convenient if httplib2 STDOUT was captured and sent to api client's 
logger. 

What version of the product are you using? On what operating system?

1.0beta8, ubuntu.

Please provide any additional information below.

Original issue reported on code.google.com by mshel...@google.com on 15 Jun 2012 at 5:29

GoogleCodeExporter commented 8 years ago

Original comment by jcgregorio@google.com on 20 Jun 2012 at 1:03

GoogleCodeExporter commented 8 years ago
A better solution to this might be to change httplib2's outputting to use 
Python's logging?

Original comment by afs...@google.com on 9 Aug 2012 at 6:15

GoogleCodeExporter commented 8 years ago
The 'bad' logging is actually coming from httplib, not httplib2, so the fix 
isn't that easy.

Original comment by jcgregorio@google.com on 9 Aug 2012 at 12:58

GoogleCodeExporter commented 8 years ago
Ah, OK. There are a number of print statements in httplib2 too, is it worth 
fixing them?

Original comment by afs...@google.com on 9 Aug 2012 at 3:11

GoogleCodeExporter commented 8 years ago
Yes, those should be cleaned up regardless of how we handle the httplib logging.

Original comment by jcgregorio@google.com on 9 Aug 2012 at 3:14