diff --git a/inspirehep/config.py b/inspirehep/config.py index a5afe4d5bc..e63d4e9995 100644 --- a/inspirehep/config.py +++ b/inspirehep/config.py @@ -23,6 +23,7 @@ """INSPIREHEP app configuration.""" from __future__ import absolute_import, division, print_function +from logging.config import dictConfig import os import sys @@ -1700,3 +1701,35 @@ # ========== FEATURE_FLAG_ENABLE_REFEXTRACT_SERVICE = False REFEXTRACT_SERVICE_URL = 'http://example_refextract_url.cern.ch' + +# logging +# ========== +dictConfig( + { + "version": 1, + "formatters": { + "default": { + "format": "[%(asctime)s: %(levelname)s/%(processName)s] %(name)s: %(message)s", + } + }, + "handlers": { + "console": { + "level": "INFO", + "class": "logging.StreamHandler", + "formatter": "default", + "stream": sys.stdout + } + }, + "loggers": { + "inspirehep.modules": { + "level": "INFO", + "handlers": ["console"], + "propagate": True + }, + "": { + "level": "INFO", + "handlers": ["console"] + } + }, + } +) diff --git a/inspirehep/modules/logger/config.py b/inspirehep/modules/logger/config.py index 69e971048f..c5d77d2ace 100644 --- a/inspirehep/modules/logger/config.py +++ b/inspirehep/modules/logger/config.py @@ -8,22 +8,21 @@ from __future__ import absolute_import, division, print_function import logging +import sys -# Logging config -# ============== -formatter = logging.Formatter( - "[%(asctime)s][%(levelname)s] %(name)s " - "%(filename)s:%(funcName)s:%(lineno)d | %(message)s", -) +from celery.signals import setup_logging -handler = logging.StreamHandler() -handler.setFormatter(formatter) +# Celery config +# ============== +@setup_logging.connect +def setup_basic_logging(*args, **kwargs): + logging.basicConfig( + format="%(message)s", stream=sys.stdout, level=logging.INFO + ) -root_logger = logging.getLogger() -root_logger.addHandler(handler) -root_logger.setLevel(logging.INFO) # Sentry config +# ============== SENTRY_DSN = None """sentry domain"""