Skip to content

Commit

Permalink
Update gunicorn.conf.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cdhigh committed Nov 28, 2024
1 parent c3791cb commit 72b30eb
Showing 1 changed file with 44 additions and 50 deletions.
94 changes: 44 additions & 50 deletions docker/gunicorn.conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}

0 comments on commit 72b30eb

Please sign in to comment.