Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import logging
- FORMAT = '%(asctime)-15s %(message)s'
- logging.basicConfig(format=FORMAT)
- logger = logging.getLogger(__name__)
- def bar():
- try:
- raise Exception("test")
- except:
- logger.exception("oops")
- def foo():
- foo1()
- def foo1():
- foo2()
- def foo2():
- bar()
- if __name__ == "__main__":
- foo()
- 2018-03-19 14:27:51,096 oops
- Traceback (most recent call last):
- File "/alextest/logexc.py", line 11, in bar
- raise Exception("test")
- Exception: test
Add Comment
Please, Sign In to add comment