- #logger.addHandler(log_handlers.SysLogHandler())
- if "log_file" in global_config:
- try:
- file_handler= logging.handlers.RotatingFileHandler(global_config["log_file"], maxBytes=100e6, backupCount=9, delay=0)
- file_handler.setFormatter(log_formatter_simple)
- logger.addHandler(file_handler)
- #logger.debug("moving logs to '%s'", global_config["log_file"])
- #remove initial stream handler
- logging.root.removeHandler(logging.root.handlers[0])
- print ("logging on '{}'".format(global_config["log_file"]))
- except IOError as e:
- raise LoadConfigurationException("Cannot open logging file '{}': {}. Check folder exist and permissions".format(global_config["log_file"], str(e)) )
- #logging.basicConfig(level = getattr(logging, global_config.get('log_level',"debug")))
+
+ # logger.addHandler(log_handlers.SysLogHandler())
+ if log_file:
+ global_config['log_file'] = log_file
+ elif global_config.get('log_file'):
+ set_logging_file(global_config['log_file'])
+
+ # logging.basicConfig(level = getattr(logging, global_config.get('log_level',"debug")))