python模块——logging(日志管理)
来源:互联网 发布:linux fd 编辑:程序博客网 时间:2024/04/27 23:24
>>> import logging
>>> LOG_FILENAME="C:\Python25\log_test.txt"
>>> logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)
>>> logging.debug("This message should go to the log file")
>>> import logging
>>> logger=logging.getLogger()
>>> handler=logging.FileHandler("Log_test.txt")
>>> logger.addHandler(handler)
>>> logger.setLevel(logging.NOTSET)
>>> logger.error("This is an error message")
>>> logger.info("This is an info message")
>>> logger.critical("This is a critical message")
This is an error message
This is an info message
This is a critical message
import logging
import sys
LEVELS={'debug':logging.DEBUG,
if len(sys.argv)>1:
logging.debug("This is a debug message")
logging.info("This is an info message")
logging.warning("This is a warning message")
logging.error("This is an error message")
logging.critical("This is a critical error message")
- python模块——logging(日志管理)
- python模块——logging(日志管理)
- python模块——logging(日志管理)
- python模块——logging(日志管理)
- python模块——logging(日志管理)
- Python模块:日志输出—logging模块
- Python日志输出——logging模块
- Python日志输出——logging模块
- Python日志输出——logging模块
- Python日志输出——logging模块
- Python日志输出——logging模块
- Python日志输出——logging模块
- Python日志输出——logging模块
- Python日志输出——logging模块
- Python日志输出——logging模块
- Python日志输出——logging模块
- Python日志输出——logging模块
- Python日志输出——logging模块
- 百度面试android工程师经历
- ZOj1015判弦图
- 【转】ALSA(lib和util)交叉编译与测试
- quartus不能生成pof文件的解决办法
- Oracle学习----多表连接
- python模块——logging(日志管理)
- 笔记:操作IIS
- 自己实现RMI(五)socket通信方案之TCP通信
- 01背包问题总结
- Android RIL的java框架
- 内核态和用户态的区别以及内核栈
- HDU 2602 Bone Collector
- bdump大小增长过快的处理方法
- Android应用程序开发以及背后的设计思想深度剖析(2)