changeset 8245:1e8458068791

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.
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 14 Feb 2020 13:56:58 +0100
parents 046fbed12f70
children e539db6cc0da
files kallithea/lib/celerylib/tasks.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/celerylib/tasks.py	Thu Feb 13 16:41:51 2020 +0100
+++ b/kallithea/lib/celerylib/tasks.py	Fri Feb 14 13:56:58 2020 +0100
@@ -27,13 +27,13 @@
 """
 
 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 @@
 __all__ = ['whoosh_index', 'get_commits_stats', 'send_email']
 
 
-log = logging.getLogger(__name__)
+log = celery.utils.log.get_task_logger(__name__)
 
 
 @celerylib.task