善用log日志
#-*- coding:utf-8 -*-
import logging logger = logging.getLogger() #定义一个log日志对象
hdlr = logging.FileHandler('sendlog.txt') #日志存放的位置
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') #记录日志的格式
hdlr.setFormatter(formatter)
logger.addHandler(hdlr) #文件对象引入到生成的日志对象里边
logger.setLevel(logging.NOTSET) #默认的日志等级
logger.debug('this is a debug message')
logger.error('this is an error message')
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAb0AAABZCAIAAAAl7m0zAAAUt0lEQVR4nO1c7VMTyb7O/5ba+5Gtukvd+2H1VPlp9Vb1sveuulXn1KmdQLKKuOwJhBeJURcx5uAKjiCQ4OIiQsJLwlteIAkhvAoIKHp0dz275n6Yl0xmenq6Jwko/p56yurp+fXTT/+655dRMJbxcOxRJA0EAoFASlp+iaSBQCAQSE/L8PQSEAgEAulpGZ7JAIFAIJCelsczGSAQCATS0zIyuwwEAoFAelqezGWBQCAQSE/L6PwKDb9tbCP8CQQCgR8Pjevmj3OZ//jP/wpt7H7y6WdD2e1PPv2MT2188ulnHbGVTz797HIo9v2Tmd6u1iNfCRAIBB4OLWPRVQJHo6uNU8n0/qvE7sHM9vPxzb3htWcDy1vdqY1b8RXPXMY+HKkbmXbaT5F1jic7v/vcNXX0NoBA4OHSEoytETgUW/XMLiX3DmI7B5Gn+2Pru0Mr2w+WNu8m127Gs20zS9zPk56phNN+iqxjnp0XrF9cvx9bC8b6/q/igqdMs8TWgr9c//zbvqA4UaVVzQue2JrnW21/IUWred5v+vLzpnC5PAOBwKOgJRRfJ7BrbrkrthrKrI0srQ4ls33xTPd86vb0wvVwvDk0Xzcy/b9dg75wzGk/RdYxz58uWL+43htfD8X7v664cK1Ms8TXQ/H13uYvP2+O4G7pTP3TBZ14Gk0gEPih0jKe2CDw2nTav7gxt/MivLUf3Nz7ZXW7f/lpd2rdm1jxzC87w6mvex7PbO057afIOub50wXrFzd6ExvjiYGvKy5cL9MsIqcvfYGdQjH14xsnd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NZ+1V1DfVaQxxajXA4dwPsA+P5N2l+CK5Ufmn5WHcN9KZVOqXwW01+MH0qfqltQNwEqwPdvMuD9r5tHVdcM9SkPDLafkPajPQ+Ajxbw/ZsMII/CzmLCMI2OXvxh1l+mtUDdBBwnwPdvMjwwhLdFvSXrFQLKeHP6hoaxMUz7S1+hZOj1q+bV9pPrpt4Uhn606yX4oZciz1ukTg6XUrlNL0LQ0UrptVl1aJzQ6GNHMfWz6mA8w/dvkmchr4v+Lv289H608YYbYeiKXodyvWRBmn7CcTKxiXqCTGk0necidQjpon9wyPPqHVFsvwkdsh9Vo5hjw9rPdgDg+zfp1ViPo2lB0zom1kVTqkz7/IDqJv0l63Tl0JGB1aHZFxUMx2L7yXWT7AE7UFs3sT7NHUiyjrboY/MjBsD3b9IL0pcJ08aK1DHx/BSjYzohhPNqaEbvFn3Sij/POdxDaGJeEzo0KSrmoDLtNWFepjOsXYgF976pGoLNG6Ffr00Oxs8O379Jr1m8TpF16sh1yqH/gdZNpoBS6ZRpX2huvW9109AbVpbcbyiYD4Dv3yyVH+xd+g+9kujkdNalVSCPJegQfNLrF9NPs3YmV4Y6H8/nLmHs+1A3S3J+tD5l6JnHbBx8/yZZwVCH4IScBMp+Vh1sPGGlrPmhzHxOf7O0CnrppRxFs0zC0gj2yMZMp8K0jnaIdjilGmEgk0l6HUMnOcW+YNUMLRGmVieLWJf15s3fhf+f/pGA5gQDAB8VCHXTYCDUzWMPyo99AOAjBNOrcX4U1E0AAABgAtRNAAAAYAPUTQAAAGAD1E0AAABgA9RNAAAAYAPUTQAAAGAD1E0AAABgw/8Dwmdaw5oK4VgAAAAASUVORK5CYII=" alt="" />
善用log日志的更多相关文章
- Atitit.log日志技术的最佳实践attilax总结
Atitit.log日志技术的最佳实践attilax总结 1. 日志的意义与作用1 1.1. 日志系统是一种不可或缺的单元测试,跟踪调试工具1 2. 俩种实现[1]日志系统作为一种服务进程存在 [2] ...
- mysql general log日志
注:应一直出现http://www.cnblogs.com/hwaggLee/p/6030765.html文章中的问题 故mysql general log日志.查看具体是什么命令导致的. 打开 ge ...
- 使用触发器实现记录oracle用户登录失败信息到alert.log日志文件
前面我们说了用oracle自带的审计功能可以实现记录用户登录失败日志到数据表中(链接:http://www.54ok.cn/6778.html).今天我们来分享一下如何把用户登录失败信息记录到aler ...
- Junit测试打印详细的log日志,可以看到sql
Junit测试打印详细的log日志,可以看到sql 在log4j.xml的日志配置文件中,把日志级别从info级别调整到debug级别: <?xml version="1.0" ...
- iOS及时log日志查看工具 (iConsole)
github下载地址:https://github.com/nicklockwood/iConsole 偶然看到的一个iOS及时log日志查看工具,通过该工具,我们可以在任何想看日志的时候,通过手势呼 ...
- svn update -r m path 代码还原到某个版本(这样之前的log日志也就没了,也就是清空log日志)
[root@ok 资料库]# svn log 简历 ------------------------------------------------------------------------ r ...
- 【个人使用.Net类库】(2)Log日志记录类
开发接口程序时,要保证程序稳定运行就要时刻监控接口程序发送和接收的数据,这就需要一个日志记录的类将需要的信息记录在日志文件中,便于自己维护接口程序.(Web系统也是如此,只是对应的日志实现比这个要复杂 ...
- [转] C#实现自动化Log日志
qing2005原文地址 C#实现自动化Log日志 在开发项目的时候,我们不免要使用Log记录日志,使用最多的是Log4Net和EntLib Log,在需要记录日志的代码处加入log.Write(日志 ...
- android的Log日志打印管理工具类(一)
android的Log日志的打印管理工具类: package com.gzcivil.utils; import android.util.Log; /** * 日志打印管理 * * @author ...
随机推荐
- Spring测试
测试类添加两个注解 @RunWith(SpringJUnit4ClassRunner.class)和@ContextConfiguration(locations = "classpath: ...
- genymotion模拟器配置X86模拟器加速器
网上下载zip包 http://download.csdn.net/download/we5868123/9430140 直接拖进去即可,虚拟机不能使用管理员权限启动 名字为:解决genymotion ...
- Linux下wps字体问题
1.安装symbol-fonts_1.2_all.deb,自行搜索 2.卸载xfonts-mathml字体 sudo apt-get remove xfonts-mathml
- dedecms 自定义标签的方法
function lib_demotest(&$ctag,&$refObj) { global $dsql,$envs; //属性处理 $attlist="row|12,ti ...
- Pyramid of Glasses(递推)
Pyramid of Glasses time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Java动态绑定的内部实现机制
JAVA虚拟机调用一个类方法时,它会基于对象引用的类型(通常在编译时可知)来选择所调用的方法.相反,当虚拟机调用一个实例方法时,它会基于对象实际的类型(只能在运行时得知)来选择所调用的方法,这就是动 ...
- 关于PS的一些总结
1.设计给的图,单独用里边的个别图层 打开图 — 新建一个图层(ctrl+n) — (点开上面的窗口排列-垂直排列,左下边下边自动选择改成图层)—选择移动工具,选中要移动的图层,拉到新建文件夹中. ...
- PAT 天梯赛 L2-007 家庭房产
建图+DFS 题目链接:https://www.patest.cn/contests/gplt/L2-007 题解 在热身赛的时候没有做出来,用的并查集的思想,但是敲残了,最后也没整出来.赛后听到别人 ...
- js中call方法的使用介绍
js call call 方法 请参阅 应用于:Function 对象 要求 版本 5.5 调用一个对象的一个方法,以另一个对象替换当前对象. call([thisObj[,arg1[, arg2[, ...
- oracle账户锁定解决方法
今天进使用orcle中,发现系统中,system账户登录里提示账户被锁定 ,后来查了查资料,问题解决,方法如下: Microsoft Windows [版本 5.2.3790] (C) 版权所有 19 ...