diff --git a/docker/gunicorn.conf.py b/docker/gunicorn.conf.py index 05b7dcd1..2cc92d59 100644 --- a/docker/gunicorn.conf.py +++ b/docker/gunicorn.conf.py @@ -12,57 +12,51 @@ certfile = os.getenv('GUNI_CERT') keyfile = os.getenv('GUNI_KEY') #example: https://github.com/benoitc/gunicorn/blob/master/gunicorn/glogging.py -if os.getenv('USE_DOCKER_LOGS') == 'yes': - accesslog = "/data/gunicorn.access.log" - errorlog = "-" - loglevel = os.getenv('LOG_LEVEL') or 'INFO' - capture_output = False -else: - capture_output = True - logconfig_dict = { - 'version': 1, - 'disable_existing_loggers': False, - "root": {"level": "INFO", "handlers": ["error_file"]}, - 'loggers': { - "gunicorn.error": { - "level": os.getenv("LOG_LEVEL") or "INFO", - "handlers": ["error_file"], - "propagate": False, - "qualname": "gunicorn.error" - }, - "gunicorn.access": { - "level": os.getenv("LOG_LEVEL") or "INFO", - "handlers": ["access_file"], - "propagate": False, - "qualname": "gunicorn.access" - } +capture_output = True +logconfig_dict = { + 'version': 1, + 'disable_existing_loggers': False, + "root": {"level": "INFO", "handlers": ["error_file"]}, + 'loggers': { + "gunicorn.error": { + "level": "INFO", + "handlers": ["error_file"], + "propagate": False, + "qualname": "gunicorn.error" }, - 'handlers': { - "error_file": { - "class": "logging.handlers.RotatingFileHandler", - "maxBytes": 2*1024*1024, #2M, >20000lines - "backupCount": 1, - "formatter": "generic", - "filename": "/data/gunicorn.error.log" - }, - "access_file": { - "class": "logging.handlers.RotatingFileHandler", - "maxBytes": 500*1024, #500K >3000lines - "backupCount": 1, - "formatter": "access", - "filename": "/data/gunicorn.access.log" - } + "gunicorn.access": { + "level": "INFO", + "handlers": ["access_file"], + "propagate": False, + "qualname": "gunicorn.access" + } + }, + 'handlers': { + "error_file": { + "class": "logging.handlers.RotatingFileHandler", + "maxBytes": 2*1024*1024, #2M, >20000lines + "backupCount": 1, + "formatter": "generic", + "filename": "/data/gunicorn.error.log" + }, + "access_file": { + "class": "logging.handlers.RotatingFileHandler", + "maxBytes": 500*1024, #500K >3000lines + "backupCount": 1, + "formatter": "access", + "filename": "/data/gunicorn.access.log" + } + }, + 'formatters':{ + "generic": { + "format": "[%(asctime)s] %(levelname)s [%(filename)s:%(lineno)s] %(message)s", + "datefmt": "%Y-%m-%d %H:%M:%S %z", + "class": "logging.Formatter" }, - 'formatters':{ - "generic": { - "format": "[%(asctime)s] %(levelname)s [%(filename)s:%(lineno)s] %(message)s", - "datefmt": "%Y-%m-%d %H:%M:%S %z", - "class": "logging.Formatter" - }, - "access": { - "format": "%(message)s", - "datefmt": "%Y-%m-%d %H:%M:%S %z", - "class": "logging.Formatter" - } + "access": { + "format": "%(message)s", + "datefmt": "%Y-%m-%d %H:%M:%S %z", + "class": "logging.Formatter" } } +}