Conrad Ho <conrad.alwin...@gmail.com> added the comment:

Hi,

I have referenced the original patch and created an updated patch that uses the 
logging module + f-strings in place of the print statements in the http.client 
module. Also updated the relevant tests for print/logging in test_httplib to 
reflect these changes.

The HTTPHandlerTest testcase from test_logging was also affected. In the 
testcase, it gets a logger with name 'http' and adds a logging.HTTPHandler to 
it. In our patch, we create a http.client logger, which happens to be 
considered a child of this testcase logger under the logger naming hierarchy.

This causes http.client logging events to propagate up to the 'http' logger and 
for the testcase to loop infinitely (ie. the HTTPHandler calls http.client 
functions internally. These functions log events using the http.client logger, 
which propagate up to the testcase http logger which calls HttpHandler again).

I have simply changed the testcase getLogger name to not be 'http' and clash 
with that http.client module logger.

----------
nosy: +Conrad Ho
Added file: https://bugs.python.org/file47727/http-client-logging-v2.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue24255>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to