diff --git a/Script/CastorScript.py b/Script/CastorScript.py index 3c265bbbc61bc5ecdc82f68438b2697b5a9b8740..cfd285affbeaec85c1e329d69c13d2024fce7882 100644 --- a/Script/CastorScript.py +++ b/Script/CastorScript.py @@ -13,7 +13,7 @@ import logging.handlers import importlib #Imports of script -from cs.Tools.utils import set_log_level, formatter +from cs.Tools.utils import set_log_level, formatter, enableFileLogging from cs.Threads.ManagerThread import ManagerThread from cs.Threads.CopyThread import CopyThread from cs.Threads.DeleteThread import DeleteThread @@ -107,6 +107,9 @@ def main(conf): set_log_level(LogLevel, mainLog) logger.addHandler(mainLog) + # get logger to files, (Will also log to ERS, when enabled) + logger = enableFileLogging("main","mainLog.out", conf.LogDir, conf.LogLevel) + ##### Setup ERS ##### if conf.ERSenabled: try: @@ -131,8 +134,8 @@ def main(conf): check = CheckThread(conf, manager, copy, delete, event, main_ERS_handler) - ##### Create db logger ##### - dbLog = logging.FileHandler(os.path.join(conf.LogDir,'DatabaseLog.out'), + ##### Create db file logger ##### + dblogger = enableFileLogging("Database","DatabaseLog.out",conf.LogDir,conf.LogLevel) 'w') dbLog.setFormatter(formatter) dblogger = logging.getLogger('Database')