Skip to content

Creating a Client with logging=True sets the logging level for requests globally.  #12

Description

@daronstinnett

I noticed this because our tests created a client with logging=True, which caused subsequent tests in other applications to log requests to the console. Removing the logging=True kwarg solved the issue.

Activity

  1. stevula commented on Dec 21, 2016

    @stevula
    Contributor

    Thanks. We'll look into it.

    https://github.com/synapsepay/SynapsePayRest-Python/blob/master/synapse_pay_rest/http_client.py#L83-L97

        def log_information(self, should_log):
            """Log requests to stdout."""
            if should_log:
                try:
                    import http.client as http_client
                except ImportError:
                    # Python 2
                    import httplib as http_client
                http_client.HTTPConnection.debuglevel = 1
    
                logging.basicConfig()
                logging.getLogger().setLevel(logging.DEBUG)
                requests_log = logging.getLogger("requests.packages.urllib3")
                requests_log.setLevel(logging.DEBUG)
                requests_log.propagate = True
    
  2. stevula commented on Feb 9, 2017

    @stevula
    Contributor

    @sankaet any ideas on how to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions