aurora-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua Cohen" <jco...@twopensource.com>
Subject Re: Review Request 26424: Disable requests http connection logging.
Date Wed, 08 Oct 2014 16:51:42 GMT


> On Oct. 8, 2014, 4:28 p.m., Bill Farner wrote:
> > src/main/python/apache/aurora/common/transport.py, line 28
> > <https://reviews.apache.org/r/26424/diff/2/?file=714839#file714839line28>
> >
> >     I find it odd to extract a function for this.  If i were a newcomer, i would
immediately inline this function for a 3->1 line code savings.
> >     
> >     If you feel strongly about extracting a function, a comment is needed to explain
the thought process.
> 
> Joshua Cohen wrote:
>     My thought process was, "it's already weird for initializing the transport to have
a side effect of globally changing the log level for requests, this way if something needs
to change requests logging without instantiating a transport, they could just invoke this
function."
>     
>     Does that sound reasonable enough to keep the function? If so, I can add a comment,
if not I can inline.
> 
> Bill Farner wrote:
>     To me, the otherwise-unused function only adds to the weirdness of it all :-)
>     
>     I say YAGNI - inline, add a comment that we don't like doing this, but want quiet
output.
>     
>     Side note: is there no other wsy to do this?  It's surprising that this ia a global
setting in the library.

I'll inline the call. As far as I can see, there's no other way to do this. From the requests
docs:

    import requests
    import logging

    # these two lines enable debugging at httplib level (requests->urllib3->httplib)
    # you will see the REQUEST, including HEADERS and DATA, and RESPONSE with HEADERS but
without DATA.
    # the only thing missing will be the response.body which is not logged.
    import httplib
    httplib.HTTPConnection.debuglevel = 1

    logging.basicConfig() # you need to initialize logging, otherwise you will not see anything
from requests
    logging.getLogger().setLevel(logging.DEBUG)
    requests_log = logging.getLogger("requests.packages.urllib3")
    requests_log.setLevel(logging.DEBUG)
    requests_log.propagate = True

We could do it for something other than the top-level requests logger if we wanted, but I
think silencing requests in general is preferable.


- Joshua


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/26424/#review55805
-----------------------------------------------------------


On Oct. 7, 2014, 8:32 p.m., Joshua Cohen wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/26424/
> -----------------------------------------------------------
> 
> (Updated Oct. 7, 2014, 8:32 p.m.)
> 
> 
> Review request for Aurora, Joe Smith and Bill Farner.
> 
> 
> Bugs: AURORA-770
>     https://issues.apache.org/jira/browse/AURORA-770
> 
> 
> Repository: aurora
> 
> 
> Description
> -------
> 
> Disable requests http connection logging.
> 
> 
> Diffs
> -----
> 
>   src/main/python/apache/aurora/common/transport.py 6f7c355d725b5e537cc4ae471170eaa8431da326

>   src/test/python/apache/aurora/common/test_transport.py c722eae2d04dec90e9c772f49c578184a2bdf76c

> 
> Diff: https://reviews.apache.org/r/26424/diff/
> 
> 
> Testing
> -------
> 
> Added hokey test, ran hokey test.
> 
> Also verified the lack of http connection logs when running client commands directly.
> 
> 
> Thanks,
> 
> Joshua Cohen
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message