Title: Replace debuglevel-related logic with logging
Type: enhancement Stage: needs patch
Components: Library (Lib) Versions: Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: CuriousLearner, berker.peksag, demian.brecht, erynofwales, msosey, r.david.murray, sloonz, xgdomingo
Priority: normal Keywords: easy, patch

Created on 2015-05-21 06:25 by demian.brecht, last changed 2018-05-14 20:06 by msosey.

File name Uploaded Description Edit
http-client-logging.patch erynofwales, 2015-06-07 17:17 review
Messages (6)
msg243734 - (view) Author: Demian Brecht (demian.brecht) * (Python triager) Date: 2015-05-21 06:25
Far too many times have I wished that changing the logging output in http.client was controllable through logging configuration rather than code changes modifying a connection's debuglevel.

It would be nice if the http package was brought up to date and had debuglevel-related code replaced with logging and sane logging was added throughout.
msg243750 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-05-21 13:57
msg244919 - (view) Author: Eryn Wells (erynofwales) * Date: 2015-06-06 16:28
Hi. This is my first issue, but I'd be willing to have a go at updating this module. Do either of you have specific ideas about what changes you want here? 

My thought was to import logging, create a logger object, and start by replacing all the self.debuglevel stuff with appropriate log statements. Does that make sense? Do each of the classes need separate loggers, or is just one module-level logger enough?
msg244960 - (view) Author: Eryn Wells (erynofwales) * Date: 2015-06-07 17:17
Here's a patch that replaces all the debuglevel stuff with logging. There's a single module-level logger that handles it all.

I wasn't sure if it would be okay to break API compatibility, so I kept the debuglevel flag and the set_debuglevel() method even though they don't do anything.

Most of the information that was being print()ed is still there, but I cleaned it up a little and added a few more messages.

The INFO level messages are pretty sparse, with DEBUG providing a lot more raw data from the request.
msg312426 - (view) Author: Sanyam Khurana (CuriousLearner) * (Python triager) Date: 2018-02-20 18:03
Hey Erin,

Can you please convert your patch to a PR on Github?
msg316571 - (view) Author: Megan Sosey (msosey) * Date: 2018-05-14 20:06
I'm going to work on this one since the original reporter last commented 3 years ago. I took a quick look at how the other modules are handling logging to see if I could make it consistent, and they all do it a bit differently. It might be worthwhile considering normalizing logging across the modules at some point. I'm working with the python 3.8 currently on master.
Date User Action Args
2018-05-14 20:06:44msoseysetnosy: + msosey
messages: + msg316571
2018-02-20 18:03:29CuriousLearnersetnosy: + CuriousLearner
messages: + msg312426
2018-02-11 02:40:36xgdomingosetnosy: + xgdomingo
2018-02-09 14:19:06sloonzsetnosy: + sloonz
2015-12-11 02:31:23r.david.murraylinkissue25835 superseder
2015-10-03 04:07:42berker.peksaglinkissue19917 superseder
2015-06-07 17:17:28erynofwalessetfiles: + http-client-logging.patch
keywords: + patch
messages: + msg244960
2015-06-06 16:54:36berker.peksagsetnosy: + berker.peksag
2015-06-06 16:28:11erynofwalessetnosy: + erynofwales
messages: + msg244919
2015-05-21 16:41:57demian.brechtsetkeywords: + easy
2015-05-21 13:57:57r.david.murraysetnosy: + r.david.murray
messages: + msg243750
2015-05-21 06:25:54demian.brechtcreate