Skip to content

Commit

Permalink
document how to enable pymongo logging using the LOGGING setting
Browse files Browse the repository at this point in the history
  • Loading branch information
aclark4life authored and timgraham committed Nov 21, 2024
1 parent 84d0f04 commit ca8ac6a
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,28 @@ Congratulations, your project is ready to go!

## Troubleshooting

TODO
### Debug logging

To troubleshoot MongoDB connectivity issues, you can enable [PyMongo's logging](
https://pymongo.readthedocs.io/en/stable/examples/logging.html) using
[Django's `LOGGING` setting](https://docs.djangoproject.com/en/stable/topics/logging/).

This is a minimal `LOGGING` setting that enables PyMongo's `DEBUG` logging:

```python
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"handlers": {
"console": {
"class": "logging.StreamHandler",
},
},
"loggers": {
"pymongo": {
"handlers": ["console"],
"level": "DEBUG",
},
},
}
```

0 comments on commit ca8ac6a

Please sign in to comment.