+ if not global_config["http_console_host"]:
+ global_config["http_console_host"] = global_config["http_host"]
+ if global_config["http_host"]=="0.0.0.0":
+ global_config["http_console_host"] = socket.gethostname()
+
+ #Configure logging STEP 2
+ if "log_host" in global_config:
+ socket_handler= log_handlers.SocketHandler(global_config["log_socket_host"], global_config["log_socket_port"])
+ socket_handler.setFormatter(log_formatter_complete)
+ if global_config.get("log_socket_level") and global_config["log_socket_level"] != global_config["log_level"]:
+ socket_handler.setLevel(global_config["log_socket_level"])
+ logger.addHandler(socket_handler)
+ #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.setLevel(getattr(logging, global_config['log_level']))
+ logger.critical("Starting openmano server command: '%s'", sys.argv[0])
+