python中logging模块的一些简单用法
用Python写代码的时候,在想看的地方写个print xx 就能在控制台上显示打印信息,这样子就能知道它是什么了,但是当我需要看大量的地方或者在一个文件中查看的时候,这时候print就不大方便了,所以Python引入了logging模块来记录我想要的信息。
print也可以输入日志,logging相对print来说更好控制输出在哪个地方,怎么输出及控制消息级别来过滤掉那些不需要的信息。
1、日志级别
import logging # 引入logging模块
# 将信息打印到控制台上
logging.debug(u"苍井空")
logging.info(u"麻生希")
logging.warning(u"小泽玛利亚")
logging.error(u"桃谷绘里香")
logging.critical(u"泷泽萝拉")
回显:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAANYAAABBCAIAAAAi4s2CAAAHoElEQVR4nO2dTW7qMBDH33mSPduyq4TYATukx64VPUA5RW/AqrcoEkfhKrxFghl7Pjx2TBz65i9UQfxJ8+vM2Jmkf9qx9Pr5/fP9+do00ZrN6+f3z8/X33jNiQt+5b9fPz9ff7mav+YrZ+hP7Ql4ev38Pp1Op9Pp950MDsFf/JWVmhaCpv9QhqCpsgzBKer68V57Cp7wfArO0BCcoqIn2FW4fryTL7mtvj5XB37k5qAcwhCcojQ2BlIoNNeggPGKoqM5rrSUhuAUlYSg8F7Zp75I4F4/k0BxBA+bt+tusfb38w6bt+vmxfv48X5ZzsI64I/JlTbNy3n/dt2vDrc+m/nKfQxauYZyq3uFW6vzvM4eRzCrPGXg0h1XNhS8qjxcHQTXyy2JoI/U9rhcBdUgps1scdm/QZguu+29B3Tamtnist8eZ+CI2KqZr3zKZ8fdUA7ylI2g3qpl2Dm5z+dHcN7B93Lev0Hb4yHYzI67/mPT13w5Q4B0CJKtYOfVVRzB6Mf2Fr3BN9n9y+sJEsHU94HiCN7P9A2L7pQ7BB2OhHd2CM5XzjneYGoOmx7ZFASJVs18dfUrY62XW+yd4R8Pdt9dk/7l/xGSRd5BFH4I0+iUavkwc/BNcByTxEEWDKG0gkloBkpB8ObsOgQBT/3pD0jyojoUtJ3nTTNbXHaLdc+QFkHcar3cRg0P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tz+CD+qDlOdjXEyQ6Zz0CV2JqmsvPlotZfdnDPYMCt2mdIwX8QgtgU6T21voJ+PqVkF+jKKzUo1Du+gD+5VTQK5AaaoiM2JenKX1HgTrnQT3Sg1FZRmRU0/V8yBE2VZQiaKssQfDJFdxkHdiscyasclSE4dQlrF3k5El3VDlkyR+eplyH4BIpuNHL19eZqoBWU68syBJ9AGuw09Uv57rIxgBbB/voVup6hT9x3peHzh7oXvEbMXIkRpgFHDO8QQOkItTTwuW9RRylbOKFU6YLJEYdvYusu0Pm59W3bHjbUQwSpPHuBgNQiYRq3UuLB/8+LYMv7x9TdY41XJe3lg3a/oVQIkv965F4k5tkXRFCYRusnTgv5LxU1BMHgTVJIBy2WZgjuYFCagTsp7fMFuby9aJ59KQTlabT8g/+jCE78ToBOHIIyIiTBsnvVuFSyZzxVpZQP+mVzlqJ59sUQFKchPPg/H8GP+ncCdML2KdVRKrHQVMME543lVAJBMc9+JAT5B//nOeKJ3AnQKckdRy2cMIpcGfp0YcTUb1cMwZbJsx8HQSEkHYBg/TsBOJPDoRAN+ISx9K1GRxA5FKhonn25WJCdhvzg/wcgWO1fkgQhnVyH6wQXRW2b3NvDEWxdYBTdlKHy7EtuyjDTkB/8nx8LTuNOADLs00CQtMIQxhKqJbXipN+apv/VaiRxX1wDsjsv0tY0MQ35wf/ETji1hp3snQBkIJhqh/RwyIzKvT0WQVMtBV6SM3JBfbITeRQ9fO5nhqHFMgSfQHnWRdNDBjHDJxPIEDRVliFoqixD0FRZhqCpsgxBU2UZgqbKMgRNlfUPuO6nJRPJJl8AAAAASUVORK5CYII=" alt="" />
上面可以看到只有后面三个能打印出来
默认生成的root logger的level是logging.WARNING,低于该级别的就不输出了
级别排序:CRITICAL > ERROR > WARNING > INFO > DEBUG
debug : 打印全部的日志,详细的信息,通常只出现在诊断问题上
info : 打印info,warning,error,critical级别的日志,确认一切按预期运行
warning : 打印warning,error,critical级别的日志,一个迹象表明,一些意想不到的事情发生了,或表明一些问题在不久的将来(例如。磁盘空间低”),这个软件还能按预期工作
error : 打印error,critical级别的日志,更严重的问题,软件没能执行一些功能
critical : 打印critical级别,一个严重的错误,这表明程序本身可能无法继续运行
这时候,如果需要显示低于WARNING级别的内容,可以引入NOTSET级别来显示:
import logging # 引入logging模块
logging.basicConfig(level=logging.NOTSET) # 设置日志级别
logging.debug(u"如果设置了日志级别为NOTSET,那么这里可以采取debug、info的级别的内容也可以显示在控制台上了")
回显:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA0YAAAAbCAIAAADXvgj7AAALpklEQVR4nO1dS27rOgy967HnGT2gfaMARWZtZwWSWYvbBaSryA46yi76gC6lW8kbOHVkSTw6pD+xWx4UF4lEUpTEny07988/N//WGlTV9vDx8d83Dtsq7F3vj2ljh317+Dju19WZYHv4+DhswXBAYNPV4LhfZwWmX1sWTNZ8rar1/nhhOTN+HLZV1faG0yGnHEpLp3bdKUeM6e6EOrQE1faQyg9nkeUqwmBsDYtkgdJqROq1a4uV/x6qsFORQKxhdovTruxSqLoi275MqmDzovJmX27cKJ01MNGQ5eO43+6PxU2p1vtj44fr/bGhCOYClAe7XMsWFa9MN0oAd5BWI2Vsu2zGFm5H5L+h330ctutgeW2bAhYqUj5SVeLCTlQH252ddSoTR4BaWHnb8kYpQFr543697hq2xAXmBZQPlckGf2lTaiLRO66FP9qSrieKrhihjcOjajUqoikzmW/pU74i5r9689cQoI/yi554HxRdfjz81DWfybwmUyPNm+2VyRjDeZJaLqYu6WqNNYxqtVMinDL2lh8z5aug+r42v7YiIuavIUAf5X+VYVfV9tC9d3WViS/a2ABmMq8p1UitqD0hGmM4T1LLxRVKOgbtjeKfZzeSt/zgKTt+M36nYYfHZL9q4o6REB28gocB+sOT1HIx05LO4XA4HA6Hw8HDSzqHw+FwOByOxcNLuhFxen25tgpnnF5fmL/rajgIzVAjzmfvZgjD4sx2PbWKzXYiPw/pUk/ps8zo/Igq3WbuX1d3AVIB235JNIB3VjHES7oRYdhpvtiKGjF92EJ+Nt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的格式,在里面自定义设置日期和时间,输出日志的时候将会按照设置的格式显示内容。
Logging.Logger:Logger是Logging模块的主体,进行以下三项工作:
1. 为程序提供记录日志的接口
2. 判断日志所处级别,并判断是否要过滤
3. 根据其日志级别将该条日志分发给不同handler
常用函数有:
Logger.setLevel() 设置日志级别
Logger.addHandler() 和 Logger.removeHandler() 添加和删除一个Handler
Logger.addFilter() 添加一个Filter,过滤作用
Logging.Handler:Handler基于日志级别对日志进行分发,如设置为WARNING级别的Handler只会处理WARNING及以上级别的日志。
常用函数有:
setLevel() 设置级别
setFormatter() 设置Formatter
3、日志输出-控制台
import logging # 引入logging模块
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s') # logging.basicConfig函数对日志的输出格式及方式做相关配置
# 由于日志基本配置中级别设置为DEBUG,所以一下打印信息将会全部显示在控制台上
logging.info('this is a loggging info message')
logging.debug('this is a loggging debug message')
logging.warning('this is loggging a warning message')
logging.error('this is an loggging error message')
logging.critical('this is a loggging critical message')
上面代码通过logging.basicConfig函数进行配置了日志级别和日志内容输出格式;因为级别为DEBUG,所以会将DEBUG级别以上的信息都输出显示再控制台上。
回显:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA1UAAABoCAIAAACWkU1/AAAgAElEQVR4nO1dTY7juA5+54n32VbtBghql8qugMmuGtUHmJxiblCruUU3kKPkKv0W/qMk8hNFK7YT88PDQ08povVDUZ9JyvpfMwt2u7///fXr3793yt//9c9/v/7756+d9vcrRNTl9j/A75+gywti/aO3/hYCTGn8Q3d8CrJL/n541jFfSb9ma0a6b+7++ue/kp20CL5JbQ3/m+1JetW5q4rPCdplvLSepsuLYLfrRnrphohYfwsBpjR+U4q92/39b7/GF+z4QysbwEr6NWczUi3665//fv3675+/FuB/m1rLG8F8/E+Dv/757/fv379//34+JZOW1hN32bFlbFOxd3//+7vHpjruuBOoRv3+/fvXr3//vpv7zTeprWFd/M/hcDgcDofDcW84/3M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573lCmmPwbAvgiDHRgVMTl9Hk7HW89b76eki9iQGsyvn6RiKfU7DTBhUKTOhYNb+jISV6c2sacjkx+7Sz8L9vlpjD/r1Esc7ZJmq7VQhoJ4b//wobkKn7/RWgGk/MqH9pLYcn/E6apAv9TRyHrCmQyt6b5/xo2/y9nUmxF+WbIuRyGhYOojJn/5dNbk91faIZmKmvxv0ZhD2mr+EFLIrls46fsRAPy/I9xP4a+RPbzv01CTml6TSxTva4Mz1JKS2vRUqUBmiKQNbvZdPLxZ5P5X/As9kWqVT7p/BHzfTLgotCS/umg4xAtfsalFGXa9pNFA6zxueCf8Ggwx/JZHaB52fEf5TdyaZYl/ge6nCmSN3JNl5lkHd1K0YQ4g47fn/81oXrQRjL+2r40HV4NNcS12GZwNIuwDRJmYhe7gf81gmJnUs0EZYt0Q2l7qwsMBqrNbFbsU6AZcWmiJ7whMhXZ1jK2bNqxik8I8NsWHqgGaJRcS2yGPJXZZgidFflfI9tDoIegCDR+yk7Uwu9/c2jRbTbLXdSxBmgiOxWRjTpJWc/Y//fEmIf/ORy1AEyKrah6M2wCHXdFlfly/ufQwuYYeDKka4yNldcC5n+58LrzP4dj7QAmxVZUvRk2gY67osp8Of9z5NF/v8ZtQdOkXvd70iyJ/w2+fTFFhkYNys9xPyJoKMf5n+OBAEyKrah6MxwrxPT5cv7ncDgcDofDsS04/3M4HA6Hw+HYFpz/ORwOh8PhcGwLzv8cDofD4XA4tgXnfw6Hw+FwOBzbgvM/h8PhcDgcjm3h/xnfCGy1dx3uAAAAAElFTkSuQmCC" alt="" />
4、日志输出-文件
import logging # 引入logging模块
import os.path
import time
# 第一步,创建一个logger
logger = logging.getLogger()
logger.setLevel(logging.INFO) # Log等级总开关
# 第二步,创建一个handler,用于写入日志文件
rq = time.strftime('%Y%m%d%H%M', time.localtime(time.time()))
log_path = os.path.dirname(os.getcwd()) + '/Logs/'
log_name = log_path + rq + '.log'
logfile = log_name
fh = logging.FileHandler(logfile, mode='w')
fh.setLevel(logging.DEBUG) # 输出到file的log等级的开关
# 第三步,定义handler的输出格式
formatter = logging.Formatter("%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s")
fh.setFormatter(formatter)
# 第四步,将logger添加到handler里面
logger.addHandler(fh)
# 日志
logger.debug('this is a logger debug message')
logger.info('this is a logger info message')
logger.warning('this is a logger warning message')
logger.error('this is a logger error message')
logger.critical('this is a logger critical message')
回显(打开同一目录下生成的文件):
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAkEAAAAWCAIAAABIct+cAAAG/klEQVR4nO2cy07jSBSG80qRWPAm2bHK1i+QzXgwuLmYhnZP0+0AhqRxWE0kNpbYZhNFoyyx0GwjzSL7Ib5qZuFLXXxcdtKEXDilb9FU6hRVwa7f/6ly1/7DggULFixYNrPUXqYegiAIgmwEqGEIgiDIpiLSMMuyft7fd7vdTqdze3tnmub1zc3V1ZXRbt91un/9/c/KR48gCIJ8ZEQa9vP+PkpLGEVhmNDr9RzHubm9QxlDEARBVohIw7rdbhRFfhD4fuD5vuf5rue7nt/r9abT6fPz8/WNufIJIAiCIB8WkYZ1Op0oiv5ki+t5vV5P0zRN0y50feUTWFceG7Vme/XDQJBNZGIpkj4oaTbsq3J/smg/Y12xh3TNwCzrDVlHRBp2e3sXRZHn+7QJcz3Pdb2Z6wVBeH7xBe73oVlLym5rlNU/NoDKpL6uOKRmpNXT+MbD/OFFlWRUtLpUavmk7NaysvcoHGfWLWrYtjAwpaSolpPVj3WgMqlnVkPHltN4fj11bFky7aLAim3I8LJmHPNFDfuqlBVjXD6LpTDW+S+Wp4KGCfpJNMw20m8m07CBKXHyhrwNBVf41HuZerZBXVfxxWaM43pSoL+LSMNM0wxzPiwrQRCenZ9Do3ls7GhP8b8fmqkMOK2dVCrYylqt2dijVeSxkUnCIuFgpffy0Kxlo5q7pdfeg2UyN076U9Sw7YB6YB+Y6Yo/sRSy9tGVkmTqBn2jjvVs0SctE9JVGAys1qZkwV0kygaGIZrFm2ApUklRbJs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P4m339pOwoWRO46SFMmyL664ZsGHe1pRWkAzbXcrCJtL3OgG7ovr8QTvWQHs9z+dNJ/o4b61QMObUUsZC71L1JAPSMttcZ0A0d9xfCKQAAAACALBBOAQAAAABkgXAKAAAAACALhFMAAAAAAFkgnAIAAAAAyALhFAAAAABAFginAAAAAACyQDgFAAAAAJAFwikAAAAAgCwQTgEAAAAAZPH/SpRG3JQINLkAAAAASUVORK5CYII=" alt="" />
5、日志输出-控制台和文件
只要在输入到日志中的第二步和第三步插入一个handler输出到控制台:
创建一个handler,用于输出到控制台
ch = logging.StreamHandler()
ch.setLevel(logging.WARNING) # 输出到console的log等级的开关
第四步和第五步分别加入以下代码即可
ch.setFormatter(formatter)
logger.addHandler(ch)
6、format常用格式说明
%(levelno)s: 打印日志级别的数值
%(levelname)s: 打印日志级别名称
%(pathname)s: 打印当前执行程序的路径,其实就是sys.argv[0]
%(filename)s: 打印当前执行程序名
%(funcName)s: 打印日志的当前函数
%(lineno)d: 打印日志的当前行号
%(asctime)s: 打印日志的时间
%(thread)d: 打印线程ID
%(threadName)s: 打印线程名称
%(process)d: 打印进程ID
%(message)s: 打印日志信息
7、捕捉异常,用traceback记录
import os.path
import time
import logging
# 创建一个logger
logger = logging.getLogger()
logger.setLevel(logging.INFO) # Log等级总开关 # 创建一个handler,用于写入日志文件
rq = time.strftime('%Y%m%d%H%M', time.localtime(time.time()))
log_path = os.path.dirname(os.getcwd()) + '/Logs/'
log_name = log_path + rq + '.log'
logfile = log_name
fh = logging.FileHandler(logfile, mode='w')
fh.setLevel(logging.DEBUG) # 输出到file的log等级的开关 # 定义handler的输出格式
formatter = logging.Formatter("%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s")
fh.setFormatter(formatter)
logger.addHandler(fh)
# 使用logger.XX来记录错误,这里的"error"可以根据所需要的级别进行修改
try:
open('/path/to/does/not/exist', 'rb')
except (SystemExit, KeyboardInterrupt):
raise
except Exception, e:
logger.error('Failed to open file', exc_info=True)
回显(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8FCZt8Xo5O4J94T7i7izvlNbkB7NEKbIjaDlT1phwLqZdjjV2lPe5Po+yN8j1Os4fMr+yvVxFEa2IS49uoPsxyFTEcq9P9DqTZJ4P+HCShOj7qEgY5upNZSd0HYi7nYvXqzel8TNIdoT6A2aJANkx4Od9vbIjdFlsvuzQCz69nSKyQxkGvNOjIbKjSP9HzzR3lkYv96G3oab/I+6vJHLEa5mbSMIoF29vQTuh913EulGG7Ii2L9SlSVG6DWYGWna08uQKOIktB9mIYNy6qsk/yN/YqjYzLSroP1eca5fsobeX9EbIUkX84WqJ65CIekPTQ9tL5heMa+wMjP4hTcn2NZe42gu2i2tsUD9wFoR0obHeqwNxvnnd1vSbbMeqjuxtjX19vUJ7hXrJ9mra5fopV6ppF+cPmDFo2THbyDO+yUyv52B6KW+ycZbLnt6p7Nd1G05L/wBAMo+yAwCgoRaBC2ENwGwD2QEAAACAioDsAAAAAEBFQHYAAAAAoCIgOwAAAABQEZAdAAAAAKgIyA4AAAAAVMT/AxTVKKiv0oi8AAAAAElFTkSuQmCC" alt="" />
如果需要将日志不上报错误,仅记录,可以将exc_info=False,回显如下:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAqIAAABsCAIAAAA+HkdJAAAWvklEQVR4nO2dW3MUyZXH+2Ps1+Cx9T77OhE7Eatnv1RsbIQeNhyx3pDDMW0Q4iZRTWMYg0BcJezd8RA7Drc8Gi87eIDpASQQIAmpQAgQN3HxYHvRpVujfehL5fVkZnV1qbv0/0UH0Z2VefLkpfNfJ7MaZTatyRcK6+Uy8crt3GVvDfAE+S6vWHtf9DKZrnywpf6AxJg63bPnq5fN5wEAAAUZ+6x+/tCg7w8MHjwwMLhv/4G9+/b37927u3/Prt39O/v6cjt3ffrLna1zNP0E+a5MDWg8AACAWHCQeQAAAAB0FpB5AAAAILVA5gEAAIDUopX5OQAAAKCjSFI+OwXIPAAAgJSQpHx2Cg4yPzIycu78+bNnz545c+bUqdPDw8MnTp4cGho6dvz46dOnb968m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hFFmpym8qVkpuOWyLyTfZrIy6LRjmVOG+kl7G/Vck8XbIXMu9LpMs9m2CYyH0u6U+0R0ttC5iO41aQ8bE+Zd3JDJrLBdpuOTvXqmu/ULRHsExDOyNaIEYw8LQX7hFeW/ltaYOsyTk6bKnTz3DgPE5uZcrrxPeGtrmxcfm4yAt/MfNCNr3Fc7O072SHmoS69pf67pkf+vjSDuamuX7O4hs3eQrz+0DkjjEqMCxOxNDQzTaONeyzYTyfXL1hc9mkiD25c01L+6DRvnZYn5cdYJjNxKfb1wRKb9hrfE94SbWzGT6Nv9qWccrazzDvZcao9Qnoyui5WqqvectbSBXVFdBZiUVa6Z1sk88R9mVP/0Pd3lkuMpQWjP3GtRASu/jQQ8ijT47Jv47/rcmPMpnODTVe2znXeWqZHbpdr1fZ1Ge00Q5NyokwnvlBO6wBRUOmAzfdCl27ZLldvLeeP0UNlM2362bVeOlvz/dlS1GucbiUVC2vy64xQfrjYp40Q/tuPJWGnSf8j9LPRlJyZaBptuZl+c8Km0kwTX1ebHmM/6uxYNsTGf117lXaIbMarNuk6f1z7TddeohVEV9BeWTateTISQrqTw0QpZX75o9FP4qrOGcuGbOrHl020dFiZU2eftiD7r3NDzk9/NFZq028R+rN1JFQNSJLEZk+SyF8VOj0u++2GcTHSpSe8srSa9LUINAOmAQG6Jm2keLq3+u6YuOsn7s2ThHAAgge2LVv+xWxz0C8AAABAaoHMAwAAAKkFMg8AAACkFsg8AAAAkFog8wAAAEBqgcwDAAAAqQUyDwAAAKQWyDwAAACQWiDzAAAAQGqBzAMAAACp5f8Bbti/nkRGEgYAAAAASUVORK5CYII=" alt="" />
8、多模块调用logging,日志输出顺序
warning_output.py
import logging def write_warning():
logging.warning(u"记录文件warning_output.py的日志")
error_output.py
import logging def write_error():
logging.error(u"记录文件error_output.py的日志")
main.py
import logging
import warning_output
import error_output def write_critical():
logging.critical(u"记录文件main.py的日志") warning_output.write_warning() # 调用warning_output文件中write_warning方法
write_critical()
error_output.write_error() # 调用error_output文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zodesbzDReXAt04ZOoX9vKy7DZaVpC6o88z00DeVEMbycxnJpnHhx6Y9VxuDjBjnIwwvxR0RbTLFBaMu0oTtgkE1iIMrMZcXrqivDlFR5VvXQNJS5MnFiQiSWH42MwccNcsAN9kdbnXgQwLShO2Kw2BYTGvAWFriTT6o8q3o4fW8rKOl6Rqoqwv6ARPD7FGU+bWFvK4O2lultlV6wz7ShaQz4JJE+ABFn+QcgJLUqmIZyXECyl5QkggBTBm2VcITzVgXQYBhTCx4pMLMJ9JrzGmybNW3ovtHrcVMgysxklX7o3Z17XKs0DWWmWaHznywfPiYTsEze4Gc7s2yD7ib3vA22WiUzm0CvOa9Br1nThu4V9nLPgIiXR9LySMIirUrOZXKGmoIVTgHC3/4Z51qmDY1htDVFYBMR2lDSNCXXWg+mQ1umDZ2E0ZZhiqCfZlZ/zC91dsQUaMu0oYUw2jIYDDOD0ZbBYJgZjLYMBsPMYLRlMBhmBqMtg8EwM/wPtCXQL0b5Si0AAAAASUVORK5CYII=" alt="" />
从上面来看,日志的输出顺序和模块执行顺序是一致的。
9、日志滚动和过期删除(按时间)
# coding:utf-8
import logging
import time
import re
from logging.handlers import TimedRotatingFileHandler
from logging.handlers import RotatingFileHandler def backroll():
#日志打印格式
log_fmt = '%(asctime)s\tFile \"%(filename)s\",line %(lineno)s\t%(levelname)s: %(message)s'
formatter = logging.Formatter(log_fmt)
#创建TimedRotatingFileHandler对象
log_file_handler = TimedRotatingFileHandler(filename="ds_update", when="M", interval=2, backupCount=2)
#log_file_handler.suffix = "%Y-%m-%d_%H-%M.log"
#log_file_handler.extMatch = re.compile(r"^\d{4}-\d{2}-\d{2}_\d{2}-\d{2}.log$")
log_file_handler.setFormatter(formatter)
logging.basicConfig(level=logging.INFO)
log = logging.getLogger()
log.addHandler(log_file_handler)
#循环打印日志
log_content = "test log"
count = 0
while count < 30:
log.error(log_content)
time.sleep(20)
count = count + 1
log.removeHandler(log_file_handler) if __name__ == "__main__":
backroll()
filename:日志文件名的prefix;
when:是一个字符串,用于描述滚动周期的基本单位,字符串的值及意义如下:
“S”: Seconds
“M”: Minutes
“H”: Hours
“D”: Days
“W”: Week day (0=Monday)
“midnight”: Roll over at midnight
interval: 滚动周期,单位有when指定,比如:when=’D’,interval=1,表示每天产生一个日志文件
backupCount: 表示日志文件的保留个数
python中logging模块的一些简单用法的更多相关文章
- Python中logging模块的基本用法
在 PyCon 2018 上,Mario Corchero 介绍了在开发过程中如何更方便轻松地记录日志的流程. 整个演讲的内容包括: 为什么日志记录非常重要 日志记录的流程是怎样的 怎样来进行日志记录 ...
- python中logging模块的用法
很多程序都有记录日志的需求,并且日志中包含的信息即有正常的程序访问日志,还可能有错误.警告等信息输出,python的logging模块提供了标准的日志接口,你可以通过它存储各种格式的日志,loggin ...
- python中logging模块
1. 日志的等级 DEBUG.INFO.NOTICE.WARNING.ERROR.CRITICAL.ALERT.EMERGENCY 级别 何时使用 DEBUG 详细信息,典型地调试问题时会感兴趣. 详 ...
- python中logging模块使用
1.logging模块使用场景 在写程序的时候,尤其是大型的程序,在程序中加入日志系统是必不可少的,它能记录很多的信息.刚刚接触python的时候肯定都在用print来输出信息,这样是最简单的输出,正 ...
- python中logging模块的使用
一.基本用法 只需要基本的配置,就可以使用了. import logging def fun2(): logging.basicConfig(filename="fun2.log" ...
- python 中logging模块
logging的作用:python中,logging模块主要是处理日志的.所谓日志,可理解为在软件运行过程中,所记录的的一些运行情况信息,软件开发人员可以根据自己的需求添加日志,日志可以帮助软件开发人 ...
- python 中 logging 模块的 log 函数以及坑
记录下吧,一个日志的函数,但有个坑是在调用函数时需要先将函数实例化为一个变量,否则进入某个循环时会多次刷新日志: """ 日志模块 """ ...
- python中urllib和urllib2的简单用法
import urllib #引入urllib模块,这里用urllib2也可以 fpage = urllib.urlopen( url ) #打开网页:例如url=‘http://www.xxx.co ...
- python之logging模块简单用法
前言: python引入logging模块,用来记录自己想要的信息.print也可以输入日志,但是logging相对print来说更好控制输出在哪个地方.怎么输出以及控制消息级别来过滤掉那些不需要的信 ...
随机推荐
- 由于未能创建Visual C# 2015编译器,因此未能打开项目xxx。请重新安装Visual Studio。
解决方案1: 清除如下文件夹里的内容. %AppData%\Local\microsoft\VisualStudio\14.0\ComponentModelCache or C:\Users\DEL ...
- 大数据时代——为什么用HADOOP?
转载自:http://www.daniubiji.cn/archives/538 什么叫大数据 “大”,说的并不仅是数据的“多”!不能用数据到了多少TB ,多少PB 来说. 对于大数据,可以用四个词来 ...
- java强制删除文件机制
//启动资源强制回收机制 System.gc(); 然后就可以删除了
- zabbix 监控报警详细邮件内容
AlarmHost:{HOSTNAME1} AlarmTime:{EVENT.DATE} {EVENT.TIME} AlarmLevel:{TRIGGER.SEVERITY} AlarmMessige ...
- 黄聪:HBuilder复制PHP项目后,【转到定位】功能失效
1.[工具]--[插件安装]--[Aptana php插件]--[选择]--[安装] 2.随便开几个文件,操作一下[编辑]--[整理代码格式]就可以了
- STL基础--算法(排序)
STL排序算法 排序算法要求随机访问迭代器 vector, deque, container array, native array 例子 vector<int> vec = {9,1,1 ...
- 【剑指offer】逆序输出链表
输入一个链表,按链表值从尾到头的顺序返回一个ArrayList. *考察栈的使用 *使用循环输出Stack中内容的时候,不能使用for(int i; i<stack.size();i++)因为s ...
- JDK类集框架实验(ArrayList,LinkedList,TreeSet,HashSet,TreeMap,HashMap)
ArrayList import java.util.ArrayList; public class C8_3 { public static void main(String[] args) ...
- 廖雪峰Java4反射与泛型-2注解-1使用注解
1.Annotation定义 注解是放在Java源码的类.方法.字段.参数前的一种标签.如下 package com.reflection; import org.apache.logging.log ...
- 不同AI学科之间的联系
这里只是引用deep learning中的关于不同AI学科之间联系的图示,如果想具体了解相关知识,深入学习深度学习,可以参考网站:http://www.deeplearningbook.org 下面是 ...