diff --git a/boswatch.py b/boswatch.py index 90dabc8..2a8e2de 100755 --- a/boswatch.py +++ b/boswatch.py @@ -125,11 +125,18 @@ try: globals.config = ConfigParser.ConfigParser() globals.config.read(globals.script_path+"/config/config.ini") for key,val in globals.config.items("BOSWatch"): - logging.debug(" - %s = %s", key, val) + logging.debug(" - %s = %s", key, val) except: logging.exception("cannot read config file") - else: + else: + try: + #set the loglevel of the file handler + logging.debug("set loglevel of fileHandler") + fh.setLevel(globals.config.getint("BOSWatch","loglevel")) + except: + logging.exception("cannot set loglevel of fileHandler") + #load plugins from includes import pluginLoader pluginLoader.loadPlugins() @@ -191,4 +198,4 @@ finally: logging.warning("failed in clean-up routine") finally: logging.info("BOSWatch exit()") - exit(0) \ No newline at end of file + exit(0) diff --git a/config/config.template.ini b/config/config.template.ini index fa0a032..e697a7e 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -3,6 +3,9 @@ ######################## [BOSWatch] +#set loglevel for logfile +loglevel = 20 + #time to ignore same alarm in a row (sek) fms_double_ignore_time = 5