How to log Python errors with debug information?
logging.exception() will output a stack trace alongside the error message you specify:
>>> import logging
>>> try:
... 1/0
... except ZeroDivisionError:
... logging.exception("message")
...
ERROR:root:message
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
ZeroDivisionError: division by zero
#logging #exceptions