Loading Common/Servers/CustomLogger/src/CustomLoggerImpl.cpp +25 −25 Original line number Diff line number Diff line Loading @@ -303,9 +303,9 @@ CustomLoggerImpl::closeLogfile() throw (CORBA::SystemException, ManagementErrors baci::ThreadSyncGuard guard(&_log_queue_mutex); if(checkLogging()) { setLogging(false); flush(); writeLoggingQueue(false); //empty the logging queue setLogging(false); _close_log_file(true); //close custom log file } }; Loading Loading @@ -502,7 +502,7 @@ CustomLoggerImpl::writeLoggingQueue(bool age_check) LogRecord_sp _log_record; //ACS_SHORT_LOG((LM_DEBUG, "CutomLoggerImpl : writeLoggingQueue")); baci::ThreadSyncGuard guard(&_log_queue_mutex); //ACS_SHORT_LOG((LM_DEBUG, "CutomLoggerImpl : writeLoggingQueue mutex acquired")); if(checkLogging()) if(age_check) //write the queue to file up to a certain log age while((!_log_queue.empty()) && (log_age(*_log_queue.top()) > _log_max_age)) Loading Common/Servers/CustomLogger/tests/functional/test_logging.py +18 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,24 @@ class LogFileTests(CustomLoggerTests): Management.MNG_FALSE) os.remove(file_path) def test_logging_with_closed_logfile(self): basepath = "/tmp/events" filename = "test_logging_with_closed_logfile.log" file_path = os.path.join(basepath, filename) self.custom_logger.setLogfile(basepath, filename) self.custom_logger.closeLogfile() #start a thread for continuous messaging logging_thread = LoggingThread() logging_thread.start() time.sleep(SLEEP_TIME) self.custom_logger.flush() logging_thread.stop() logging_thread.join() self.assertTrue(os.path.exists(file_path)) self.assertEqual(self.custom_logger._get_isLogging().get_sync()[0], Management.MNG_FALSE) os.remove(file_path) def test_set_file_during_logging_thread(self): basepath_first = "/tmp/events" filename_first = "test_set_first.log" Loading Loading
Common/Servers/CustomLogger/src/CustomLoggerImpl.cpp +25 −25 Original line number Diff line number Diff line Loading @@ -303,9 +303,9 @@ CustomLoggerImpl::closeLogfile() throw (CORBA::SystemException, ManagementErrors baci::ThreadSyncGuard guard(&_log_queue_mutex); if(checkLogging()) { setLogging(false); flush(); writeLoggingQueue(false); //empty the logging queue setLogging(false); _close_log_file(true); //close custom log file } }; Loading Loading @@ -502,7 +502,7 @@ CustomLoggerImpl::writeLoggingQueue(bool age_check) LogRecord_sp _log_record; //ACS_SHORT_LOG((LM_DEBUG, "CutomLoggerImpl : writeLoggingQueue")); baci::ThreadSyncGuard guard(&_log_queue_mutex); //ACS_SHORT_LOG((LM_DEBUG, "CutomLoggerImpl : writeLoggingQueue mutex acquired")); if(checkLogging()) if(age_check) //write the queue to file up to a certain log age while((!_log_queue.empty()) && (log_age(*_log_queue.top()) > _log_max_age)) Loading
Common/Servers/CustomLogger/tests/functional/test_logging.py +18 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,24 @@ class LogFileTests(CustomLoggerTests): Management.MNG_FALSE) os.remove(file_path) def test_logging_with_closed_logfile(self): basepath = "/tmp/events" filename = "test_logging_with_closed_logfile.log" file_path = os.path.join(basepath, filename) self.custom_logger.setLogfile(basepath, filename) self.custom_logger.closeLogfile() #start a thread for continuous messaging logging_thread = LoggingThread() logging_thread.start() time.sleep(SLEEP_TIME) self.custom_logger.flush() logging_thread.stop() logging_thread.join() self.assertTrue(os.path.exists(file_path)) self.assertEqual(self.custom_logger._get_isLogging().get_sync()[0], Management.MNG_FALSE) os.remove(file_path) def test_set_file_during_logging_thread(self): basepath_first = "/tmp/events" filename_first = "test_set_first.log" Loading