parent
bf0030504a
commit
abcea93050
5 changed files with 74 additions and 20 deletions
@ -0,0 +1,10 @@ |
||||
# Gunicorn config file |
||||
# |
||||
# By default, a file named gunicorn.conf.py will be read from the same directory where gunicorn is being run. |
||||
# Reference: https://docs.gunicorn.org/en/latest/settings.html |
||||
|
||||
import log |
||||
|
||||
logconfig_dict = log.LOG_DICT |
||||
workers = 1 |
||||
bind = ['0.0.0.0:5000'] |
@ -1,22 +1,47 @@ |
||||
import logging |
||||
import logging.config |
||||
|
||||
logging.config.dictConfig({ |
||||
LOG_DICT = { |
||||
'version': 1, |
||||
'formatters': {'default': { |
||||
'format': '[%(asctime)s] [%(process)d] [%(levelname)7s] %(message)s', |
||||
}}, |
||||
'handlers': {'wsgi': { |
||||
'class': 'logging.StreamHandler', |
||||
'stream': 'ext://flask.logging.wsgi_errors_stream', |
||||
'formatter': 'default' |
||||
}}, |
||||
'formatters': { |
||||
'default': { |
||||
'format': '[%(asctime)s] [%(process)d] [%(levelname)7s] %(message)s', |
||||
}, |
||||
}, |
||||
'handlers': { |
||||
'wsgi': { |
||||
'class': 'logging.StreamHandler', |
||||
'stream': 'ext://flask.logging.wsgi_errors_stream', |
||||
'formatter': 'default' |
||||
}, |
||||
'console': { |
||||
'level': 'DEBUG', |
||||
'class': 'logging.StreamHandler', |
||||
'formatter': 'default' |
||||
}, |
||||
'null': { |
||||
'level': 'DEBUG', |
||||
'class': 'logging.NullHandler', |
||||
'formatter': 'default' |
||||
}, |
||||
}, |
||||
'loggers': { |
||||
'gunicorn': { |
||||
'handlers': ['console'], |
||||
'level': 'DEBUG', |
||||
'propagate': False, |
||||
}, |
||||
}, |
||||
'root': { |
||||
'level': 'INFO', |
||||
'handlers': ['wsgi'] |
||||
} |
||||
}) |
||||
} |
||||
|
||||
logging.config.dictConfig(LOG_DICT) |
||||
logger = logging.getLogger(__name__) |
||||
|
||||
logger.info('Logging enabled.') |
||||
|
||||
from logging_tree import printout |
||||
printout() |
||||
|
Loading…
Reference in new issue