Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python logger exception

# Get Python error information with debug output
# logger.exception outputs a stack trace alongside the error message.

# Example

import logging
try:
    1/0
except ZeroDivisionError:
    logging.exception("error_log")
    
# Outputs
    
ERROR:root:error_log
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
ZeroDivisionError: integer division or modulo by zero
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #python #logger #exception
ADD COMMENT
Topic
Name
7+3 =