- 浏览: 995113 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (367)
- JavaScript (23)
- Java (60)
- Python (41)
- 其他 (36)
- SQL (4)
- 开发工具 (26)
- Linux (15)
- AJAX (6)
- Cache (3)
- 正则 (4)
- 架构 (9)
- 手机 (3)
- MySQL (4)
- Android (115)
- vps (1)
- 网站 (4)
- scale (3)
- 搜索引擎 (3)
- iPhone (2)
- hessian (1)
- hessdroid (1)
- 411 (1)
- jstat (1)
- gc (1)
- gallery (1)
- 惯性 (1)
- eclipse (1)
- mac wget error (1)
- miui file explorer 无用 解决办法 (1)
- vim (1)
最新评论
-
qingyezhangluo:
哎。楼主您既然是分享代码的为什么要加密的呢?而且问你密码还不回 ...
android应用换皮肤(转) -
MagicError:
kavoe 写道下载文件有密码。。。。
http抓包工具 -
knightdf:
我先试下再来
JAVA的RAS加密例子 -
kavoe:
下载文件有密码。。。。
http抓包工具 -
changanfounder:
hmc1985 写道setCallbackDuringFlin ...
android gallery滑动惯性问题
Formatters
Formatter objects configure the final order, structure, and contents of the log message. Unlike the base logging.Handler class, application code may instantiate formatter classes, although you could likely subclass the formatter if your application needs special behavior. The constructor takes two optional arguments: a message format string and a date format string. If there is no message format string, the default is to use the raw message. If there is no date format string, the default date format is:
Formatter对象定义了最终log信息的顺序,结构和内容.于基本的logging.Handler类不同,应用可以直接实例化formatter类,当然,如果需要你也可以子例化formatter以便定制它的一些行为.构造函数接受两个可选参数:一个信息格式字符串和一个日期格式字符串.如果没有信息格式字符串,直接输出log信息.如果没有日期格式字符串,默认的格式是:
%Y-%m-%d %H:%M:%S
with the milliseconds tacked on at the end.
毫秒加载最后面.
The message format string uses %(<dictionary key>)s styled string substitution. Here is the Formatter class's docstring, which describes the valid substitution strings and what they mean:
信息格式字符串用%(<dictionary key>)s风格的字符串做替换.下面是Formatter类的docstring,说明了现有的替换字符串和它们所代表的意思.
%(name)s Name of the logger (logging channel)
%(levelno)s Numeric logging level for the message (DEBUG, INFO,
WARNING, ERROR, CRITICAL)
%(levelname)s Text logging level for the message ("DEBUG", "INFO",
"WARNING", "ERROR", "CRITICAL")
%(pathname)s Full pathname of the source file where the logging
call was issued (if available)
%(filename)s Filename portion of pathname
%(module)s Module (name portion of filename)
%(lineno)d Source line number where the logging call was issued
(if available)
%(created)f Time when the LogRecord was created (time.time()
return value)
%(asctime)s Textual time when the LogRecord was created
%(msecs)d Millisecond portion of the creation time
%(relativeCreated)d Time in milliseconds when the LogRecord was created,
relative to the time the logging module was loaded
(typically at application startup time)
%(thread)d Thread ID (if available)
%(process)d Process ID (if available)
%(message)s The result of record.getMessage(), computed just as
the record is emitted
The following message format string will log the time in a human-readable format, the severity of the message, and the contents of the message, in that order:
下面的信息格式字符串会输出一个可读格式的串,严重级别和log信息内容以下面的格式给出:
"%(asctime)s - %(levelname)s - %(message)s"
发表评论
-
python图形处理库Python Imaging Library (PIL)简介及安装(转载收藏)
2010-10-14 13:02 2042[简介] 这两天用python写一个程序,需要对各种格式的 ... -
python:在python中使用opencv进行摄像头编程初体验
2009-12-02 13:11 3912闲着没事做,前段时间买了个摄像头,在ubuntu上用。打开ch ... -
python使用tuple作参数
2009-08-07 15:53 3574def a(*aa): print aa[0] ... -
python sort key
2009-08-07 13:18 2405>>> a=range(10) >&g ... -
python 自带小爬虫
2009-08-07 10:28 1912#! /usr/bin/env python “”" ... -
Python支持中文
2009-08-07 10:27 3174让Python支持中文要在Python代码头部加上# -* ... -
Python多线程 简明例子
2009-08-07 10:27 2978综述 多线程是 ... -
Python多线程编程
2009-08-07 10:26 4025我们在做软件开发的时 ... -
python循环采集
2009-08-07 10:26 1545html=”<td>1</td>< ... -
python的字符操作函数
2009-08-07 10:25 2070在python有各种各样的stri ... -
python去除html标签
2009-08-07 10:24 3439from HTMLParser import HTMLPars ... -
python 下载文件
2009-08-06 14:12 4806抓取数据的时候,有的时候是需要下载一些文件的,比如图片,pdf ... -
python 去除空格,回车符,换行符
2009-08-06 14:05 10626s=’ as asdas \r\nasda’print ” ... -
Python版Linux 下的迅雷
2009-07-29 11:56 2830Linux 下该不该有迅雷,这个问题一直存在分歧,在此也不予讨 ... -
linux下python默认版本的选择
2009-07-29 10:50 2526当你在linux系统下安装了不同版本的python, 怎样设定 ... -
Python监视进程
2009-06-23 11:03 2431由subprocess创建一个进程,然后进行监视 每一秒钟查看 ... -
python pyc pyo
2009-06-19 13:56 4732python并非完全是解释性语言,它是有编译的,先把源码py文 ... -
python chr()、unichr()和ord()
2009-06-18 17:15 64101chr()、unichr()和ord() chr()函数用一 ... -
python打印所有汉字...
2009-06-18 17:04 2623for ch in xrange(0x4e00, 0x9fa6 ... -
程序签名
2009-06-18 16:43 1063打开https://www.symbiansigned.com ...
相关推荐
用python写程序的,作为一个完整的项目而言,必须要有日志模块,而python的logging模块为我们提供了这么一种很好的机制,很方便的解决了这个问题。
详解python的日志模块logging和django中对logging模块的使用
logging模块是Python内置的标准模块,主要用于输出运行日志,可以设置输出日志的等级、日志保存路径、日志文件回滚等;相比print,具备如下优点: 可以通过设置不同的日志等级,在release版本中只输出重要信息,而...
转载于https://www.cnblogs.com/Nicholas0707/p/9021672.html,支持正版
许多应用程序中都会有日志模块,用于记录系统在运行过程中的一些关键信息,以便于对系统的运行...这篇文章给大家主要介绍了在Python中logging日志模块在多进程环境下的使用,需要的朋友可以参考借鉴,下面来一起看看吧。
主要介绍了python 日志 logging模块 详细解析,本文通过实例代码给大家介绍的非常详细,对大家的工作或学习具有一定的参考借鉴价值,需要的朋友可以参考下
主要介绍了Python使用logging模块实现打印log到指定文件的方法,结合实例形式分析了Python logging模块的原理及相关日志输出操作技巧,需要的朋友可以参考下
本文实例讲述了Python日志logging模块功能与用法。分享给大家供大家参考,具体如下: 本文内容: logging模块的介绍 logging模块的基础使用 logging模块的扩展使用 logging中的Filter 使用配置文件配置logging...
使用python的logging模块时,除了想将日志记录在文件中外,还希望在前台执行python脚本时,可以将日志直接输出到标准输出std.out中。 实现 logging模块可以有两种方法实现该功能: 方案一:basicconfig import ...
主要介绍了Python logging模块handlers用法详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
Python的logging模块提供了通用的日志系统,可以方便第三方模块或者是应用使用。这个模块提供不同的日志级别,并可以采用不同的方式记录日志,比如文件,HTTP GET/POST,SMTP,Socket等,甚至可以自己实现具体的日志...
本文实例讲述了python日志logging模块使用方法。分享给大家供大家参考,具体如下: 一、从一个使用场景开始 开发一个日志系统, 既要把日志输出到控制台, 还要写入日志文件 import logging # 创建一个logger ...
主要介绍了python使用logging模块发送邮件代码示例,具有一定借鉴价值,需要的朋友可以参考下
python的logging模块提供了灵活的标准模块,使得任何Python程序都可以使用这个第三方模块来实现日志记录。python logging 官方文档 logging框架中主要由四个部分组成: Loggers: 可供程序直接调用的接口 Handlers:...
logging模块是Python内置的标准模块,主要用于输出运行日志,可以设置输出日志的等级、日志保存路径、日志文件回滚等;相比print,具备如下优点: 1.可以通过设置不同的日志等级,在release版本中只输出重要信息,...
主要介绍了Python logging模块原理解析及应用,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下