From 15e7642cdf588559fa56c5a1d8daaaf94c20fb47 Mon Sep 17 00:00:00 2001 From: Andriy Brukhovetskyy Date: Tue, 7 May 2024 15:21:35 +0200 Subject: [PATCH] dist logging --- utils/dist.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/dist.py b/utils/dist.py index 41b659e8369..0fe417804c5 100644 --- a/utils/dist.py +++ b/utils/dist.py @@ -1500,6 +1500,11 @@ def init_logging(debug=False): formatter = logging.Formatter("%(asctime)s %(levelname)s:%(module)s:%(threadName)s - %(message)s") log = logging.getLogger() + for h in log.handlers[:]: + if isinstance(h, logging.StreamHandler) and h.stream == sys.stderr: + log.removeHandler(h) + h.close() + if not path_exists(os.path.join(CUCKOO_ROOT, "log")): path_mkdir(os.path.join(CUCKOO_ROOT, "log")) fh = handlers.TimedRotatingFileHandler(os.path.join(CUCKOO_ROOT, "log", "dist.log"), when="midnight", backupCount=10)