-
Notifications
You must be signed in to change notification settings - Fork 121
/
logging.conf
51 lines (42 loc) · 1.11 KB
/
logging.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# 定义logger模块,root是父类,必需存在的,其它的是自定义。
# logging.getLogger(NAME)便相当于向logging模块注册了一种日志打印
# name 中用 . 表示 log 的继承关系
[loggers]
keys=root,TimeInfoLogger,ConsoleLogger
# 定义handler
[handlers]
keys=TimeInfoHandler,ConsoleHandler
# 定义格式化输出
[formatters]
keys=TimeInfoFmt,ConsoleFmt
[logger_root]
level=DEBUG
handlers=TimeInfoHandler,ConsoleHandler
[logger_TimeInfoLogger]
level=DEBUG
handlers=TimeInfoHandler
propagate=0
qualname=TimeInfoLogger
[logger_ConsoleLogger]
level=INFO
handlers=ConsoleHandler
propagate=0
qualname=ConsoleLogger
[handler_TimeInfoHandler]
class=logging.handlers.TimedRotatingFileHandler
level=DEBUG
formatter=TimeInfoFmt
args=('log/info.log', 'midnight', 1, 6)
[handler_ConsoleHandler]
class=logging.StreamHandler
level=INFO
formatter=ConsoleFmt
args=(sys.stdout,)
[formatter_TimeInfoFmt]
format=%(asctime)s %(levelname)s %(message)s
datefmt=
class=logging.Formatter
[formatter_ConsoleFmt]
format=%(asctime)s %(filename)s %(levelname)s %(message)s
datefmt=%Y-%m-%d %H:%M:%S,%a
class=logging.Formatter