2020
10-08
10-08
详解python logging日志传输
1.生成日志并通过http传输出去(通过HTTPHandler方式):#生成并发送日志importloggingfromlogging.handlersimportHTTPHandlerimportlogging.configdefsave():logger=logging.getLogger(__name__)#生成一个log实例,如果括号为空则返回rootloggerhh=HTTPHandler(host='127.0.0.1:5000',url='/log',method='POST')#用HTTPHandler直接发送日志,而并不是写文件再传文件。logger.setLevel(logging.INFO)#设...
继续阅读 >