ROTATE_LOG_SIZE = 10 * 1024 * 1024
ROTATE_LOG_COUNT = 5
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '{levelname} {asctime} {module}:{lineno} {message}',
'style': '{',
'datefmt' : '%Y-%m-%d %H:%M:%S',
},
'extended': {
'format': '{levelname} {asctime} {message}',
'style': '{',
'datefmt' : '%Y-%m-%d %H:%M:%S',
},
'simple': {
'format': '{levelname} {message}',
'style': '{',
},
},
'handlers': {
'debug': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': os.path.join(LOG_ROOT, 'debug.log'),
'formatter': 'verbose',
},
'logger': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': os.path.join(LOG_ROOT, 'logger.log'),
'formatter': 'extended',
'maxBytes': ROTATE_LOG_SIZE,
'backupCount': ROTATE_LOG_COUNT,
},
'banking': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': os.path.join(LOG_ROOT, 'banking.log'),
'formatter': 'extended',
'maxBytes': ROTATE_LOG_SIZE,
'backupCount': ROTATE_LOG_COUNT,
},
},
'loggers': {
'debug': {
'handlers': ['debug',],
'level': 'DEBUG',
'propagate': False,
},
'logger': {
'handlers': ['logger',],
'level': 'INFO',
'propagate': False,
},
'logger.main': {
'handlers': ['logger',],
'level': 'INFO',
'propagate': False,
},
'banking': {
'handlers': ['banking',],
'level': 'INFO',
'propagate': False,
},
},
}
log# ls -l --block-size=K ./
total 12172K
-rw-r--r-- 1 www-data www-data 125K Sep 14 13:01 banking.log
-rw-r--r-- 1 www-data www-data 121K Sep 14 13:01 banking.log.1
-rw-r--r-- 1 www-data www-data 285K Sep 14 12:20 banking.log.2
-rw-r--r-- 1 www-data www-data 333K Sep 14 12:17 banking.log.3
-rw-r--r-- 1 www-data www-data 298K Sep 14 10:29 banking.log.4
-rw-r--r-- 1 www-data www-data 315K Sep 14 10:20 banking.log.5
[program:workplace-uwsgi]
command = /usr/local/projects/env/bin/uwsgi --ini /usr/local/projects/conf/uwsgi.ini
user = www-data
stdout_logfile = /usr/local/projects/var/log/uwsgi.log
stdout_logfile_maxbytes = 10MB
stderr_logfile = /usr/local/projects/var/log/uwsgi.error.log
stderr_logfile_maxbytes = 10MB
autostart = true
autorestart = true
redirect_stderr = false
priority = 999
stopsignal = QUIT