Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Add explicit gunicorn configuration for the API so logging is consistent (#2648)
Madison Swain-Bowden16104f32dc01
diff --git a/api/gunicorn.conf.py b/api/gunicorn.conf.pynew file mode 100644index 000000000..24f8e8055--- /dev/null+++ b/api/gunicorn.conf.py@@ -0,0 +1,46 @@+wsgi_app = "conf.wsgi:application"+capture_output = True+accesslog = "-"+errorlog = "-"+chdir = "/api"+bind = ["0.0.0.0:8000"]+workers = 4+timeout = 120+logconfig_dict = {+ # NOTE: Most of this is inherited from the default configuration+ # https://github.com/benoitc/gunicorn/blob/cc2e3835784542e65886cd27f64d444309fbaad0/gunicorn/glogging.py#L48-L86+ "version": 1,+ "disable_existing_loggers": False,+ "formatters": {+ "generic": {+ "format": "[%(asctime)s - %(name)s - %(lineno)3d][%(levelname)s] %(message)s", # noqa: E501+ },+ },+ "root": {"level": "INFO", "handlers": ["console"]},+ "loggers": {+ "gunicorn.error": {+ "level": "INFO",+ "handlers": ["console"],+ "propagate": False, # Prevents default handler from also logging this+ "qualname": "gunicorn.error",+ },+ "gunicorn.access": {+ "level": "INFO",+ "handlers": ["console"],+ "propagate": False, # Prevents default handler from also logging this+ "qualname": "gunicorn.access",+ },+ "": {+ "level": "INFO",+ "handlers": ["console"],+ },+ },+ "handlers": {+ "console": {+ "class": "logging.StreamHandler",+ "formatter": "generic",+ "stream": "ext://sys.stdout",+ },+ },+}+loglevel = "debug"