From: tierno Date: Mon, 26 Sep 2016 08:14:44 +0000 (+0200) Subject: v0.4.56 fixed some logging bugs X-Git-Tag: v1.0.0~30 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=b13f3ccc55a71878d8e7c501be9269d84fc85ace;p=osm%2FRO.git v0.4.56 fixed some logging bugs Change-Id: I517070e781e2500b62e3394dbfbd8db8b2f3b47d Signed-off-by: tierno --- diff --git a/db_base.py b/db_base.py index 265752f3..f6a5c59a 100644 --- a/db_base.py +++ b/db_base.py @@ -141,7 +141,7 @@ class db_base_Exception(Exception): class db_base(): tables_with_created_field=() - def __init__(self, host=None, user=None, passwd=None, database=None, log_name='db', log_level="ERROR"): + def __init__(self, host=None, user=None, passwd=None, database=None, log_name='db', log_level=None): self.host = host self.user = user self.passwd = passwd @@ -149,7 +149,8 @@ class db_base(): self.con = None self.log_level=log_level self.logger = logging.getLogger(log_name) - self.logger.setLevel( getattr(logging, log_level) ) + if self.log_level: + self.logger.setLevel( getattr(logging, log_level) ) def connect(self, host=None, user=None, passwd=None, database=None): '''Connect to specific data base. diff --git a/nfvo_db.py b/nfvo_db.py index 5b47f1d2..1dcf6f6b 100644 --- a/nfvo_db.py +++ b/nfvo_db.py @@ -39,7 +39,7 @@ tables_with_createdat_field=["datacenters","instance_nets","instance_scenarios", "sce_vnfs","tenants_datacenters","datacenter_tenants","vms","vnfs", "datacenter_nets"] class nfvo_db(db_base.db_base): - def __init__(self, host=None, user=None, passwd=None, database=None, log_name='openmano.db', log_level="ERROR"): + def __init__(self, host=None, user=None, passwd=None, database=None, log_name='openmano.db', log_level=None): db_base.db_base.__init__(self, host, user, passwd, database, log_name, log_level) db_base.db_base.tables_with_created_field=tables_with_createdat_field return diff --git a/openmanod.cfg b/openmanod.cfg index 1a101915..4ae845b7 100644 --- a/openmanod.cfg +++ b/openmanod.cfg @@ -51,21 +51,21 @@ db_name: mano_db # Name of the MANO DB #vnf_repository: "./vnfrepo" # Use an absolute path to avoid misunderstandings -#logging parameters for internal file stororage +#general logging parameters #choose among: DEBUG, INFO, WARNING, ERROR, CRITICAL log_level: DEBUG #general log levels for internal logging #standard output is used unless 'log_file' is specify #log_file: /var/log/openmano/openmano.log -#individual loggin settings +#individual logging settings #log_level_db: DEBUG #database log levels -log_file_db: /opt/openmano/logs/openmano_db.log +#log_file_db: /opt/openmano/logs/openmano_db.log #log_level_vim: DEBUG #VIM connection log levels -log_file_vim: /opt/openmano/logs/openmano_vimconn.log +#log_file_vim: /opt/openmano/logs/openmano_vimconn.log #log_level_nfvo: DEBUG #Main engine log levels -log_file_nfvo: /opt/openmano/logs/openmano_nfvo.log +#log_file_nfvo: /opt/openmano/logs/openmano_nfvo.log #log_level_http: DEBUG #Main engine log levels -log_file_http: /opt/openmano/logs/openmano_http.log +#log_file_http: /opt/openmano/logs/openmano_http.log #Uncomment to send logs via IP to an external host #log_socket_host: localhost diff --git a/openmanod.py b/openmanod.py index 5b67cf05..2fe61875 100755 --- a/openmanod.py +++ b/openmanod.py @@ -33,7 +33,7 @@ It loads the configuration file and launches the http_server thread that will li ''' __author__="Alfonso Tierno, Gerardo Garcia, Pablo Montes" __date__ ="$26-aug-2014 11:09:29$" -__version__="0.4.55-r497" +__version__="0.4.56-r498" version_date="Sep 2016" database_version="0.13" #expected database schema version @@ -62,9 +62,6 @@ def load_configuration(configuration_file): 'http_console_proxy': True, 'http_console_host': None, 'log_level': 'DEBUG', - 'log_level_db': 'ERROR', - 'log_level_vimconn': 'DEBUG', - 'log_level_nfvo': 'DEBUG', 'log_socket_port': 9022, } try: @@ -259,7 +256,7 @@ if __name__=="__main__": #nfvo.logger = global_config["logger_nfvo"] # Initialize DB connection - mydb = nfvo_db.nfvo_db(log_level=global_config["log_level_db"]); + mydb = nfvo_db.nfvo_db(); if mydb.connect(global_config['db_host'], global_config['db_user'], global_config['db_passwd'], global_config['db_name']) == -1: logger.critical("Cannot connect to database %s at %s@%s", global_config['db_name'], global_config['db_user'], global_config['db_host']) exit(-1)