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='.logmap_annotation.log',
filemode='a')

try:

  

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

原文地址:https://www.cnblogs.com/xiaoxiaoshuaishuai0219/p/8630720.html