Loading Common/Servers/CustomLogger/include/CustomLoggerImpl.h +1 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ class CustomLoggerImpl: public virtual baci::CharacteristicComponentImpl, virtual void emitExceptionLog(); virtual void flush() throw (CORBA::SystemException); void writeLoggingQueue(bool age_check=true); //invoked by writer thread void handle_xml_error(); private: void _open_log_file(bool custom, const char* base_path, const char* filename) throw (CORBA::SystemException, ManagementErrors::CustomLoggerIOErrorEx); Loading Common/Servers/CustomLogger/src/CustomLoggerImpl.cpp +21 −2 Original line number Diff line number Diff line Loading @@ -295,6 +295,7 @@ void CustomLoggerImpl::flush() throw (CORBA::SystemException) { maci::ContainerImpl::getLoggerProxy()->flush(); writeLoggingQueue(); }; void Loading Loading @@ -522,6 +523,25 @@ CustomLoggerImpl::writeLoggingQueue(bool age_check) }; }; void CustomLoggerImpl::handle_xml_error() { baci::ThreadSyncGuard guard(&_log_queue_mutex); //suspend logging thread _writer->suspend(); //empty ACS log queue maci::ContainerImpl::getLoggerProxy()->flush(); //empty CUSTOM log queue while(!_log_queue.empty()){ _log_queue.pop(); } //reinitialize EXPAT parser free_log_parsing(log_parser); log_parser = init_log_parsing(); //resume writer thread _writer->resume(); }; CustomStructuredPushConsumer::CustomStructuredPushConsumer(CustomLoggerImpl* logger) : logger_(logger) { Loading Loading @@ -593,8 +613,7 @@ void CustomStructuredPushConsumer::push_structured_event (const CosNotification: logger_->handle(lr); } }catch(const MalformedXMLError& mxe){ free_log_parsing(logger_->log_parser); logger_->log_parser = init_log_parsing(); logger_->handle_xml_error(); } }; Loading Common/Servers/CustomLogger/src/expat_log_parsing.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -279,7 +279,8 @@ get_log_record(XML_Parser log_parser, const char *xml_text) std::stringstream msg; msg << "CustomLoggerMalformedXMLError: "; msg << XML_ErrorString(XML_GetErrorCode(log_parser)); msg << " (" << xml_string.c_str() << ")"; // Commenting the following line we loose the error message //msg << " (" << xml_string.c_str() << ")"; //log_record->xml_text.assign(msg.str().c_str()); //log_record->xml_text.assign("CustomLoggerMalformedXMLError"); ACE_ERROR ((LM_ERROR, msg.str().c_str() )); Loading Loading
Common/Servers/CustomLogger/include/CustomLoggerImpl.h +1 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ class CustomLoggerImpl: public virtual baci::CharacteristicComponentImpl, virtual void emitExceptionLog(); virtual void flush() throw (CORBA::SystemException); void writeLoggingQueue(bool age_check=true); //invoked by writer thread void handle_xml_error(); private: void _open_log_file(bool custom, const char* base_path, const char* filename) throw (CORBA::SystemException, ManagementErrors::CustomLoggerIOErrorEx); Loading
Common/Servers/CustomLogger/src/CustomLoggerImpl.cpp +21 −2 Original line number Diff line number Diff line Loading @@ -295,6 +295,7 @@ void CustomLoggerImpl::flush() throw (CORBA::SystemException) { maci::ContainerImpl::getLoggerProxy()->flush(); writeLoggingQueue(); }; void Loading Loading @@ -522,6 +523,25 @@ CustomLoggerImpl::writeLoggingQueue(bool age_check) }; }; void CustomLoggerImpl::handle_xml_error() { baci::ThreadSyncGuard guard(&_log_queue_mutex); //suspend logging thread _writer->suspend(); //empty ACS log queue maci::ContainerImpl::getLoggerProxy()->flush(); //empty CUSTOM log queue while(!_log_queue.empty()){ _log_queue.pop(); } //reinitialize EXPAT parser free_log_parsing(log_parser); log_parser = init_log_parsing(); //resume writer thread _writer->resume(); }; CustomStructuredPushConsumer::CustomStructuredPushConsumer(CustomLoggerImpl* logger) : logger_(logger) { Loading Loading @@ -593,8 +613,7 @@ void CustomStructuredPushConsumer::push_structured_event (const CosNotification: logger_->handle(lr); } }catch(const MalformedXMLError& mxe){ free_log_parsing(logger_->log_parser); logger_->log_parser = init_log_parsing(); logger_->handle_xml_error(); } }; Loading
Common/Servers/CustomLogger/src/expat_log_parsing.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -279,7 +279,8 @@ get_log_record(XML_Parser log_parser, const char *xml_text) std::stringstream msg; msg << "CustomLoggerMalformedXMLError: "; msg << XML_ErrorString(XML_GetErrorCode(log_parser)); msg << " (" << xml_string.c_str() << ")"; // Commenting the following line we loose the error message //msg << " (" << xml_string.c_str() << ")"; //log_record->xml_text.assign(msg.str().c_str()); //log_record->xml_text.assign("CustomLoggerMalformedXMLError"); ACE_ERROR ((LM_ERROR, msg.str().c_str() )); Loading