Skip to content

Commit 67904c2

Browse files
committed
Add pymongo example LOGGING setting
1 parent ba4c521 commit 67904c2

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,26 @@ Congratulations, your project is ready to go!
183183

184184
## Troubleshooting
185185

186-
TODO
186+
### Debug logging
187+
188+
To troubleshoot MongoDB connectivity issues you can enable PyMongo's logging feature with Django's `LOGGING` setting.
189+
190+
Here is a minimal Django `LOGGING` configuration that enables PyMongo's `DEBUG` logging in Django:
191+
192+
```
193+
LOGGING = {
194+
'version': 1,
195+
'disable_existing_loggers': False,
196+
'handlers': {
197+
'console': {
198+
'class': 'logging.StreamHandler',
199+
},
200+
},
201+
'loggers': {
202+
'pymongo': {
203+
'handlers': ['console'],
204+
'level': 'DEBUG',
205+
},
206+
},
207+
}
208+
```

0 commit comments

Comments
 (0)