Created
May 12, 2021 15:47
-
-
Save Abhayparashar31/6586bc0b925814e3340119cb8403320f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| a = 10 | |
| b = 0 | |
| try: | |
| c = a / b | |
| except Exception as e: | |
| logging.error("Exception Occurred", exc_info=True) ## At default it is True | |
| ----------------------------------CONSOLE OUTPUT------------------------ | |
| ERROR:root:Exception Occurred ## If exc_info=False then only this message will print | |
| Traceback (most recent call last): | |
| File "C:\Users\abhay\Desktop\ds\python\advance_concepts\logging_code.py", line 5, in <module> | |
| c = a / b | |
| ZeroDivisionError: division by zero |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment