import glob
import logging
import logging.handlers
LOG_FILENAME='logging_rotatingfile_example.out'
# Set up a specific logger with our desired output level
my_logger = logging.getLogger('MyLogger')
my_logger.setLevel(logging.DEBUG)
# Add the log message handler to the logger
handler = logging.handlers.RotatingFileHandler(LOG_FILENAME,
maxBytes=20,
backupCount=5,
)
my_logger.addHandler(handler)
python如何打log
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
從Ruby 到Python
wilelm
2020-06-27 06:21:36
從Ruby 到Python
wilelm
2020-06-27 06:21:36
Python中re模塊正則表達式
FLY-DUCK
2020-02-24 22:15:00
Scrapy爬取重慶安居客二手房並存入mysql數據庫(下)
FLY-DUCK
2020-02-24 22:15:00
Scrapy爬取重慶安居客二手房並存入mysql數據庫(上)
FLY-DUCK
2020-02-24 22:15:00
Python筆記——Python3.4+PyQt5+Pycharm4.0.4程序py2exe打包步驟
我是你星爷
2020-02-23 08:03:46
Windows平臺安裝MySQL數據庫
FLY-DUCK
2019-10-26 09:25:06
Windows平臺安裝Python環境
FLY-DUCK
2019-10-26 09:25:06
python對文件夾中的文件分類處理
CHNIM
2018-11-14 07:26:01
生產環境下如何優雅地重啓 Tornado
wilelm
2018-08-22 04:50:50
Instagram 5位傳奇工程師背後的技術揭祕
wilelm
2018-08-22 04:50:48
xhtml2pdf如何支持中文
wilelm
2018-08-22 04:50:48
Dropbox可伸縮性設計最佳實踐分享
wilelm
2018-08-22 04:50:46
Rabbitmq 和 python
wilelm
2018-08-22 04:50:46
python的logging模塊學習
wilelm
2018-08-22 04:50:46