1# Get Python error information with debug output
2# logger.exception outputs a stack trace alongside the error message.
3
4# Example
5
6import logging
7try:
8 1/0
9except ZeroDivisionError:
10 logging.exception("error_log")
11
12# Outputs
13
14ERROR:root:error_log
15Traceback (most recent call last):
16 File "<stdin>", line 2, in <module>
17ZeroDivisionError: integer division or modulo by zero