-
Notifications
You must be signed in to change notification settings - Fork 1
/
gconfig.py
85 lines (77 loc) · 2.21 KB
/
gconfig.py
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import gevent.monkey
gevent.monkey.patch_all()
import multiprocessing
# debug = True
bind = "0.0.0.0:8080"
pidfile = "app/logs/gunicorn.pid"
accesslog = "app/logs/gaccess.log"
errorlog = "app/logs/gdebug.log"
loglevel = 'info'
capture_output = True
# daemon = True
# 启动的进程数
workers = (multiprocessing.cpu_count() * 2) + 1
worker_class = 'gevent'
x_forwarded_for_header = 'X-FORWARDED-FOR'
access_log_format = "%(h)s %(r)s %(s)s %(a)s %(L)s"
logconfig_dict = {
'version': 1,
'disable_existing_loggers': False,
"root": {
"level": "DEBUG",
"handlers": ["console"]
},
'loggers': {
"gunicorn.error": {
"level": "INFO",
"handlers": ["error_file"],
"propagate": 0,
"qualname": "gunicorn.error"
},
"gunicorn.access": {
"level": "DEBUG",
"handlers": ["access_file"],
"propagate": 0,
"qualname": "gunicorn.access"
},
"gunicorn.api": {
"level": "DEBUG",
"handlers": ["api_file"],
"propagate": 0,
"qualname": "gunicorn.api"
}
},
'handlers': {
"error_file": {
"class": "logging.FileHandler",
"formatter": "generic",
"filename": "app/logs/gerror.log"
},
"access_file": {
"class": "concurrent_log_handler.ConcurrentRotatingFileHandler",
"maxBytes": 10*1024*1024,
"backupCount": 5,
"formatter": "generic",
"filename": "app/logs/gaccess.log",
},
"api_file": {
"class": "concurrent_log_handler.ConcurrentRotatingFileHandler",
"maxBytes": 10*1024*1024,
"backupCount": 5,
"formatter": "generic",
"filename": "app/logs/gdebug.log",
},
'console': {
'class': 'logging.StreamHandler',
'level': 'DEBUG',
'formatter': 'generic',
},
},
'formatters': {
"generic": {
"format": "%(asctime)s [%(process)d]: [%(levelname)s] %(message)s",
"datefmt": "[%Y-%m-%d %H:%M:%S %z]",
"class": "logging.Formatter"
}
}
}