How to set request module logging to certain level (python 3.4.2)

Ian Kelly ian.g.kelly at gmail.com
Sat Apr 4 17:57:58 CEST 2015


On Sat, Apr 4, 2015 at 9:21 AM, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> On Sat, 4 Apr 2015 06:07:12 -0700 (PDT), zljubisicmob at gmail.com declaimed
> the following:
> >From requests module, I would like to log from error level above.
>>
>
>         Unless the requests module documents that is uses a logger named
> "requests", you are likely stuck with having to adjust the level of the
> root (unnamed) logger.

You can include "%(name)s" in the format string to see the name of the
logger that was used.

> http://docs.python-requests.org/en/latest/api/?highlight=log
>
> implies the correct name to use for the logger is
> "requests.packages.urllib3".

If that's the case, then configuring the "requests" logger should
work, since it's a hierarchical ancestor of
"requests.packages.urllib3".



More information about the Python-list mailing list