logging

  

import logging
import time

logging.basicConfig(filename='demo_error.log', filemode="a+", level=logging.DEBUG)

try:
a = 1/0
print(a)
except:
logging.info(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())))
logging.exception('insert error')
posted @ 2017-11-10 00:57  人微言轻1  阅读(153)  评论(0编辑  收藏  举报