v0.4.56 fixed some logging bugs
authortierno <alfonso.tiernosepulveda@telefonica.com>
Mon, 26 Sep 2016 08:14:44 +0000 (10:14 +0200)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Mon, 26 Sep 2016 08:14:44 +0000 (10:14 +0200)
Change-Id: I517070e781e2500b62e3394dbfbd8db8b2f3b47d
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
db_base.py
nfvo_db.py
openmanod.cfg
openmanod.py

index 265752f..f6a5c59 100644 (file)
@@ -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. 
index 5b47f1d..1dcf6f6 100644 (file)
@@ -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
index 1a10191..4ae845b 100644 (file)
@@ -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
index 5b67cf0..2fe6187 100755 (executable)
@@ -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)