From 489f1c9f15d4147c865134157ed8568d4db2df91 Mon Sep 17 00:00:00 2001 From: Hidden Z Date: Tue, 2 Nov 2010 18:34:25 +0000 Subject: [PATCH] web/lib/utils.py: add workaround for django It helps to avoid multiple root loggers. --- web/lib/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/lib/utils.py b/web/lib/utils.py index 0eeb1c4..6a72d95 100644 --- a/web/lib/utils.py +++ b/web/lib/utils.py @@ -8,6 +8,10 @@ from logging import handlers def get_logger(filename=None, log_level='debug'): """ Prepare logger instance for our scripts """ + # workaround for django + if hasattr(logging, "web_logger"): + return logging.web_logger + LEVELS = { 'debug': logging.DEBUG, 'info': logging.INFO, @@ -27,6 +31,9 @@ def get_logger(filename=None, log_level='debug'): handler.setFormatter(formatter) logger.addHandler(handler) + # workaround for django + logging.web_logger = logger + return logger