python エラー処理

例外のログを記録する

import logging 
def foo():
    try:
        some_code()
    except:
        logging.exception('')

How to log python exception? - Stack Overflow

Pythonの例外とその処理に関する覚え書き(概要、書式、後始末処理) - 試験運用中なLinux備忘録