Snowflake-Labs / django-snowflake

MIT License
59 stars 15 forks source link

Document how to enable the Python connector's logging #64

Closed sfc-gh-hachouraria closed 1 year ago

sfc-gh-hachouraria commented 1 year ago

Logging from the connector is required to troubleshoot issues with connectivity (such as in environments with proxies, firewalls, etc.) or generally any unexpected errors.

This change adds a short troubleshooting section to the README docs illustrating how DEBUG logging can be enabled to the stderr.

timgraham commented 1 year ago

I'm fine linking to Snowflake docs on this. I'm less enthusiastic about including some minimal code. If such code is useful, why isn't it in the connector's docs? Also, the example outputs all Python debug logging which could include things from Django and other Python libraries the developer is using. This might a lot to sift through.

Further, it might be helpful to point out how this code interacts with the way that Django configures logging. This can be a confusing topic! Probably I would advise this sort of code as a very temporary measure to debug a problem. Don't leave it in production, right?

sfc-gh-hachouraria commented 1 year ago

Thank you for taking a look at this PR Tim,

I hadn't realized that Django also uses logging underneath. It makes sense to configure the connector through Django's LOGGING, and to only turn on the connector relevant logging.

I've rewritten the section to link to Django's docs and added an example showing how the connector logging can be influenced through Django's settings, and tested it internally to work (modifying from a copy of Django's default LOGGING configuration).

Thoughts on the current form?