Gunicorn - sjherrick/code-base GitHub Wiki
import logging
from gunicorn import glogging
class CustomGunicornLogger(glogging.Logger):
def setup(self, cfg):
super().setup(cfg)
# Add filters to Gunicorn logger
logger = logging.getLogger("gunicorn.access")
logger.addFilter(FilterTest())
class FilterTest(logging.Filter):
def filter(self, record):
return 'GET /logged/' not in record.getMessage()
accesslog = '-'
logger_class = CustomGunicornLogger
- add "--logger-class", "<filename>.CustomGunicornLogger" argument to the gunicorn command in the dockerfile