From 1d938a2198f4d53d26fe800c4db6ec5341ec84f4 Mon Sep 17 00:00:00 2001
From: Jonas <jonas@holm.tech>
Date: Mon, 15 Apr 2019 12:56:31 +0200
Subject: [PATCH] Vastly simplified setup of root logger

---
 Script/CastorScript.py       |  3 +--
 Script/cs/Tools/LogConfig.py | 10 ++++------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/Script/CastorScript.py b/Script/CastorScript.py
index 908d1bb..fc4e7f8 100644
--- a/Script/CastorScript.py
+++ b/Script/CastorScript.py
@@ -69,8 +69,7 @@ if config.DdmMonitoringEnabled:
 
 def main(conf):
 
-    # Root should only log to mail or ERS, but initializes root logger if no none set
-    LogConfig.disable_root_logging_to_stdout()
+    LogConfig.enable_root_logger()
 
     ##### enable mail logging #####
     if conf.mailList:
diff --git a/Script/cs/Tools/LogConfig.py b/Script/cs/Tools/LogConfig.py
index 52c7f35..a9ab2bb 100644
--- a/Script/cs/Tools/LogConfig.py
+++ b/Script/cs/Tools/LogConfig.py
@@ -44,12 +44,10 @@ def set_environment(config, tdaq_app_name):
     os.environ["TDAQ_ERS_DEBUG"] = config.ers_debug
 
 
-def disable_root_logging_to_stdout():
-    ##### Set root Logging to file: NULL #####
-    logging.basicConfig(level=logging.DEBUG,
-                        format='%(asctime)s %(levelname)-8s %(message)s',
-                        datefmt='%a, %d %b %Y %H:%M:%S',
-                        filename= '/dev/null',filemode='w')
+def enable_root_logger():
+    #let all logs get to the root logger 
+    #(log levels are set in each handler)
+    logging.getLogger().setLevel("DEBUG")
 
 def enable_mail_logging(config):
     # by default max email sending rate is 10 per hour
-- 
GitLab