# HG changeset patch # User Mads Kiilerich # Date 2020-02-14 13:56:58 # Node ID 1e84580687919bdcc31e9186b9dee250e790237a # Parent 046fbed12f70f9ccd52a22c908ca912615d36249 celery: fix logging from inside tasks Celery will hijack the global logging configuration and disable the usual Kallithea logging (unless CELERYD_HIJACK_ROOT_LOGGER is set False). Fixed partially by using the special celery loggers inside the tasks. Logging from modules will still not work. diff --git a/kallithea/lib/celerylib/tasks.py b/kallithea/lib/celerylib/tasks.py --- a/kallithea/lib/celerylib/tasks.py +++ b/kallithea/lib/celerylib/tasks.py @@ -27,13 +27,13 @@ Original author and date, and relevant c """ import email.utils -import logging import os import traceback from collections import OrderedDict from operator import itemgetter from time import mktime +import celery.utils.log from tg import config import kallithea @@ -50,7 +50,7 @@ from kallithea.model.db import RepoGroup __all__ = ['whoosh_index', 'get_commits_stats', 'send_email'] -log = logging.getLogger(__name__) +log = celery.utils.log.get_task_logger(__name__) @celerylib.task