Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
daronstinnett opened this issue Nov 30, 2016 · 2 comments
Labels

Comments

@daronstinnett
Copy link

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.

@stevula stevula added the bug label Dec 6, 2016
@stevula
Copy link
Contributor

stevula commented Dec 21, 2016

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

@stevula
Copy link
Contributor

stevula commented Feb 9, 2017

@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
Labels
Projects
None yet
Development

No branches or pull requests

2 participants