Created
November 2, 2017 15:11
-
-
Save joar/868e440b30bf619f5aee7d737fb5a660 to your computer and use it in GitHub Desktop.
gunicorn - disable logging configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gunicorn.glogging | |
import structlog | |
_logger = structlog.get_logger(__name__) | |
class Logger(gunicorn.glogging.Logger): | |
def setup(self, cfg): | |
""" | |
Attempts to override gunicorn's logging configuration entirely | |
""" | |
_logger.warning('gunicorn-logging-override') | |
# Override gunicorns false start at logging configuration in __init__() | |
self.access_log.propagate = True | |
self.error_log.propagate = True | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You **NEED** this file in order to get gunicorn to be able to load te module containing your logger. | |
from setuptools import setup, find_packages | |
setup( | |
name='gunicorn_logging', | |
version='0.1.0-dev', | |
packages=find_packages(), | |
entry_points={ | |
'gunicorn.loggers': [ | |
'gunicorn_logging.Logger = gunicorn_logging.Logger' | |
] | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment