diff --git a/include/Nebula.h b/include/Nebula.h index 41fabb9a7a..784a255ce0 100644 --- a/include/Nebula.h +++ b/include/Nebula.h @@ -156,6 +156,25 @@ public: // Environment & Configuration // -------------------------------------------------------------- + /** + * Returns the value of DEBUG_LEVEL in oned.conf file + * @return the debug level, to instantiate Log'ers + */ + Log::MessageType get_debug_level() const + { + Log::MessageType clevel = Log::ERROR; + int log_level_int; + + nebula_configuration->get("DEBUG_LEVEL", log_level_int); + + if (0 <= log_level_int && log_level_int <= 3 ) + { + clevel = static_cast(log_level_int); + } + + return clevel; + } + /** * Returns the value of ONE_LOCATION env variable. When this variable is * not defined the nebula location is "/". diff --git a/src/nebula/Nebula.cc b/src/nebula/Nebula.cc index 3d279aba54..7ccb90c74b 100644 --- a/src/nebula/Nebula.cc +++ b/src/nebula/Nebula.cc @@ -85,18 +85,11 @@ void Nebula::start() try { - string log_fname; - int log_level_int; - Log::MessageType clevel = Log::ERROR; + string log_fname; + Log::MessageType clevel; log_fname = log_location + "oned.log"; - - nebula_configuration->get("DEBUG_LEVEL", log_level_int); - - if (0 <= log_level_int && log_level_int <= 3 ) - { - clevel = static_cast(log_level_int); - } + clevel = get_debug_level(); // Initializing ONE Daemon log system diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index f25160dcf0..6b530500b2 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -170,7 +170,10 @@ int VirtualMachine::select(SqlDB * db) //-------------------------------------------------------------------------- try { - _log = new FileLog(nd.get_vm_log_filename(oid),Log::DEBUG); + Log::MessageType clevel; + + clevel = nd.get_debug_level(); + _log = new FileLog(nd.get_vm_log_filename(oid), clevel); } catch(exception &e) {