Python的logger配制文件
1:logger.conf
###############################################
[loggers]
keys=root,manylog,daylog [logger_root]
level=DEBUG
handlers=hand01,hand02 [logger_manylog]
handlers=hand01,hand03
qualname=manylog
propagate= [logger_daylog]
handlers=hand01,hand04
qualname=daylog
propagate= ############################################### [handlers]
keys=hand01,hand02,hand03,hand04 [handler_hand01]
class=StreamHandler
level=DEBUG
formatter=test
args=(sys.stderr,) [handler_hand02]
class=FileHandler
level=DEBUG
formatter=test
args=('logs/log.log', 'a') [handler_hand03]
class=handlers.RotatingFileHandler
level=DEBUG
formatter=online
args=('logs/log.log', 'a', **, ) [handler_hand04]
class=handlers.TimedRotatingFileHandler
level=INFO
formatter=online
args=('logs/log_', 'D', , ) ############################################### [formatters]
keys=test,online [formatter_test]
format=[%(asctime)s] [%(levelname)s] [%(filename)s:%(lineno)d] Msg:%(message)s
datefmt=%Y-%m-%d %H:%M:%S [formatter_online]
format=[%(asctime)s] [%(thread)d] [%(levelname)s] [%(filename)s:%(lineno)d] Msg:%(message)s
datefmt=%Y-%m-%d %H:%M:%S
2:logger_factory.py
import logging
import logging.config from app.common.file import app_path def log_factory(name='root'):
log_conf = os.getcwd()+ '/logging.conf'
logging.config.fileConfig(log_conf)
logger = logging.getLogger(name)
return logger
Python的logger配制文件的更多相关文章
- [Python] logging.logger
<1>. mylogger = logging.getLogger("abc") logging.debug()/logging.info()/logging.warn ...
- python批量处理excel文件数据
https://www.zhihu.com/question/39299070?sort=created 作者:水中柳影链接:https://www.zhihu.com/question/392990 ...
- [python]自动化将markdown文件转成html文件
*:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !important; } /* ...
- nginx指定配制文件
nginx启动: 未指定配制文件: ./nginx 指定配制文件: /usr/local/nginx/sbin/nginx -c /home/deploy/nginx-wz/conf/nginx.co ...
- python中的pth文件作用
python中有一个.pth文件,该文件的用法是: 首先xxx.pth文件里面会书写一些路径,一行一个. 将xxx.pth文件放在特定位置,则可以让python在加载模块时,读取xxx.pth中指定的 ...
- python 函数初识和文件操作
文件操作 打开文件:文件句柄 = open('文件路径', '模式') 打开文件的模式 w #以写的方式打开 (不可读,不存在则创建,存在则删除内容) a #以追加的模式打开(可读, 不存在则创建 ...
- 使用python求字符串或文件的MD5
使用python求字符串或文件的MD5 五月 21st, 2008 #以下可在python3000运行. #字符串md5,用你的字符串代替'字符串'中的内容. import hashlib md5=h ...
- python中__init__.py文件的作用
问题 在执行models.py时,报ImportError:No module named transwarp.db的错误,但明明transwarp下就有db.py文件,路径也没有错误.真是想不通.后 ...
- python下读取excel文件
项目中要用到这个,所以记录一下. python下读取excel文件方法多种,用的是普通的xlrd插件,因为它各种版本的excel文件都可读. 首先在https://pypi.python.org/py ...
随机推荐
- Django不能使用ip方式访问的解决办法
问题: 启动服务后,使用http://127.0.0.1:8000/showcase/或者http://localhost:8000/showcase/都能访问, 但是使用http://192.168 ...
- 题解 P1720 【月落乌啼算钱】
题目链接 定义一个函数比较好求. #include<bits/stdc++.h>//万能头文件 using namespace std; double F(int x)//定义函数,为了保 ...
- 【离散数学】 SDUT OJ 传递闭包 && memset 使用注意事项
传递闭包 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Problem Description 已知有n头牛,m次战斗关系, ...
- Day 4 上午
内容提要 进制转换 高精度 数论:筛法,gcd/exgcd,逆元 进制转换 10=2^3+2^0=1010(2)10=3^2+3^0=101(3) 10进制x-->k进制:短除法 k进制x--& ...
- 按钮重复点击问题 UIbutton
.h #import <UIKit/UIKit.h> #import <objc/runtime.h> @interface UIControl (XY) @property ...
- Qt 学习之路 2(47):视图选择
Qt 学习之路 2(47):视图选择 豆子 2013年3月28日 Qt 学习之路 2 34条评论 选择是视图中常用的一个操作.在列表.树或者表格中,通过鼠标点击可以选中某一项,被选中项会变成高亮或者反 ...
- ubuntu下安装谷歌浏览器
deb 是 Debian Linux 的安装格式,在 ubuntu 中同样可以使用.要安装 deb 安装包,需要使用 dpkg这个终端命令,命令格式如下: $ sudo dpkg -i <pac ...
- 洛谷 P2486 [SDOI2011]染色(树链剖分+线段树)
题目链接 题解 比较裸的树链剖分 好像树链剖分的题都很裸 线段树中维护一个区间最左和最右的颜色,和答案 合并判断一下中间一段就可以了 比较考验代码能力 Code #include<bits/st ...
- Python RabbitMQ 消息队列
RabbitMQ是一个在AMQP基础上完整的,可复用的企业消息系统.他遵循Mozilla Public License开源协议. MQ全称为Message Queue, 消息队列(MQ)是一种应用程序 ...
- Python- sort()/sorted()
Python list内置sort()方法用来排序,也可以用python内置的全局sorted()方法来对可迭代的序列排序生成新的序列. sorted(iterable,key=None,revers ...