AliBZ
AliBZ

Reputation: 4099

Disable grequests error logs on console

Is there anyway to disable grequests's logging to console? My applications returns error in the requests part:

Timeout: (<requests.packages.urllib3.connectionpool.HTTPConnectionPool object at 0x10daa1a50>, 'Connection to 116.231.213.50 timed out. (connect timeout=5)')
<Greenlet at 0x10d92bf50: <bound method AsyncRequest.send of <grequests.AsyncRequest object at 0x10da97990>>(stream=False)> failed with Timeout

I found this to disable requests's logging but no luck with the grequests.

Upvotes: 0

Views: 426

Answers (1)

Vinay Sajip
Vinay Sajip

Reputation: 99485

If you used the approach in your link to disable requests logging (e.g. logging.getLogger("requests").setLevel(logging.CRITICAL)) then it should work for grequests too. Have you tried it? If you have and it still doesn't behave as you would like, configure logging to show logger names (e.g. via basicConfig using %(name)s in the format string) and you should see exactly which loggers are producing the messages, and you can then silence them using the same approach as for the requests logger.

Upvotes: 1

Related Questions