Reduce output logging

279
1
Jump to solution
08-13-2022 07:22 AM
RichardWhite
New Contributor III

When I pass a URL to the GIS constructor, I'm getting a lot of DEBUG logging that I'd like to reduce:
     gis = GIS(url, username, password)

Bunches of lines similar to this:
     022-08-13 10:16:34,561 DEBUG : Starting new HTTPS connection (1): <url>

Normally, I would control this by setting the logging level for the imported library:
     logging.getLogger('arcgis').setLevel(logging.ERROR)

I suspect that this is coming from an underlying HTTP or fetch module imported into the arcgis module.

Any suggestions?

0 Kudos
1 Solution

Accepted Solutions
RichardWhite
New Contributor III
Setting the level to WARN turns off the bulk of the logger messages:
   logging.getLogger('arcgis').setLevel(logging.WARN)
   logging.getLogger('requests').setLevel(logging.WARN)
   logging.getLogger('requests_oauthlib').setLevel(logging.WARN)
   logging.getLogger('urllib3').setLevel(logging.WARN)

View solution in original post

0 Kudos
1 Reply
RichardWhite
New Contributor III
Setting the level to WARN turns off the bulk of the logger messages:
   logging.getLogger('arcgis').setLevel(logging.WARN)
   logging.getLogger('requests').setLevel(logging.WARN)
   logging.getLogger('requests_oauthlib').setLevel(logging.WARN)
   logging.getLogger('urllib3').setLevel(logging.WARN)
0 Kudos