You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/11/02 15:35:21 UTC

[GitHub] [nifi-minifi-cpp] arpadboda commented on a diff in pull request #1436: MINIFICPP-1963 improve exception logging

arpadboda commented on code in PR #1436:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1436#discussion_r1011951807


##########
libminifi/src/SchedulingAgent.cpp:
##########
@@ -115,11 +115,11 @@ bool SchedulingAgent::onTrigger(core::Processor* processor, const std::shared_pt
     processor->onTrigger(processContext, sessionFactory);
     processor->decrementActiveTask();
   } catch (std::exception &exception) {
-    logger_->log_debug("Caught Exception %s", exception.what());
+    logger_->log_debug("Caught Exception during SchedulingAgent::onTrigger, type: %s, what: %s", typeid(exception).name(), exception.what());

Review Comment:
   I think this log msg would be more talkative in case we log the name of the processor and the uuid of that to identify which processor threw the given exception. 



##########
libminifi/src/core/ProcessGroup.cpp:
##########
@@ -153,8 +153,10 @@ void ProcessGroup::startProcessingProcessors(const std::shared_ptr<TimerDrivenSc
   for (const auto processor : failed_processors_) {
     try {
       processor->onUnSchedule();
+    } catch (const std::exception& ex) {
+      logger_->log_error("Exception occured during unscheduling processor: %s (%s), type: %s, what: %s", processor->getUUIDStr(), processor->getName(), typeid(ex).name(), ex.what());

Review Comment:
   This log line is useful, but I wonder if it can occur... Throw in unschedule definitely sounds like something to avoid. 



##########
libminifi/src/SchedulingAgent.cpp:
##########
@@ -115,11 +115,11 @@ bool SchedulingAgent::onTrigger(core::Processor* processor, const std::shared_pt
     processor->onTrigger(processContext, sessionFactory);
     processor->decrementActiveTask();
   } catch (std::exception &exception) {
-    logger_->log_debug("Caught Exception %s", exception.what());
+    logger_->log_debug("Caught Exception during SchedulingAgent::onTrigger, type: %s, what: %s", typeid(exception).name(), exception.what());
     processor->yield(admin_yield_duration_);
     processor->decrementActiveTask();
   } catch (...) {
-    logger_->log_debug("Caught Exception during SchedulingAgent::onTrigger");
+    logger_->log_debug("Caught Exception during SchedulingAgent::onTrigger, type: %s", getCurrentExceptionTypeName());

Review Comment:
   Same here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org