import logging class MyException(Exception): def __str__(self): return 'str() was called' try: raise MyException() except Exception as e: logging.exception(e)
Standard input is empty
Standard output is empty
ERROR:root:str() was called Traceback (most recent call last): File "prog.py", line 8, in <module> MyException: str() was called