python 简单日志处理(输出log文件)

#!-usr-bin-env python3

import logging
import os

# ================================================================
# cofigure log
# ================================================================
logging.basicConfig(
level=logging.ERROR,
format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
datefmt='%a, %d %b %Y %H:%M:%S',
filename='.\log\map_annotation.log',
filemode='a')

 

try:

  

except Exception as e:
   print("Error: multipleAnnotation except" + str(e))
   ogging.error(str(e))

 

posted @ 2018-03-23 15:46  Littlefish-  阅读(1154)  评论(0编辑  收藏  举报
Document