diff --git a/Framework/include/QualityControl/AggregatorRunner.h b/Framework/include/QualityControl/AggregatorRunner.h index bb71e7ed5f..d37091cd71 100644 --- a/Framework/include/QualityControl/AggregatorRunner.h +++ b/Framework/include/QualityControl/AggregatorRunner.h @@ -140,7 +140,6 @@ class AggregatorRunner : public framework::Task */ void prepareInputs(); - void initInfoLogger(framework::InitContext& iCtx); void initDatabase(); void initMonitoring(); void initServiceDiscovery(); diff --git a/Framework/include/QualityControl/CheckRunner.h b/Framework/include/QualityControl/CheckRunner.h index 2fd03eac5c..90a5f13f30 100644 --- a/Framework/include/QualityControl/CheckRunner.h +++ b/Framework/include/QualityControl/CheckRunner.h @@ -174,7 +174,6 @@ class CheckRunner : public framework::Task void initDatabase(); void initMonitoring(); void initServiceDiscovery(); - void initInfologger(framework::InitContext& iCtx); void initLibraries(); /** diff --git a/Framework/include/QualityControl/TaskRunner.h b/Framework/include/QualityControl/TaskRunner.h index dabcf9ec77..3df7186b9e 100644 --- a/Framework/include/QualityControl/TaskRunner.h +++ b/Framework/include/QualityControl/TaskRunner.h @@ -125,7 +125,6 @@ class TaskRunner : public framework::Task /// \brief Checks if all the expected data inputs are present in the provided InputRecord static bool isDataReady(const framework::InputRecord& inputs); void refreshConfig(framework::InitContext& iCtx); - void initInfologger(framework::InitContext& iCtx); void printTaskConfig() const; void startOfActivity(); void endOfActivity(); diff --git a/Framework/include/QualityControl/runnerUtils.h b/Framework/include/QualityControl/runnerUtils.h index e5e446a52e..ad2b15bf8e 100644 --- a/Framework/include/QualityControl/runnerUtils.h +++ b/Framework/include/QualityControl/runnerUtils.h @@ -77,6 +77,8 @@ std::string templateILDiscardFile(std::string& originalFile, framework::InitCont uint64_t getCurrentTimestamp(); +void initInfologger(framework::InitContext& iCtx, core::DiscardFileParameters infologgerDiscardParameters, std::string facility, std::string detectorName = ""); + } // namespace o2::quality_control::core #endif // QUALITYCONTROL_RUNNERUTILS_H diff --git a/Framework/src/AggregatorRunner.cxx b/Framework/src/AggregatorRunner.cxx index 55e07f3cd2..083ca0e629 100644 --- a/Framework/src/AggregatorRunner.cxx +++ b/Framework/src/AggregatorRunner.cxx @@ -149,7 +149,7 @@ std::string AggregatorRunner::createAggregatorRunnerName() void AggregatorRunner::init(framework::InitContext& iCtx) { - initInfoLogger(iCtx); + core::initInfologger(iCtx, mRunnerConfig.infologgerDiscardParameters, "aggregator"); refreshConfig(iCtx); QcInfoLogger::setDetector(AggregatorRunner::getDetectorName(mAggregators)); Bookkeeping::getInstance().init(mRunnerConfig.bookkeepingUrl); @@ -313,26 +313,6 @@ void AggregatorRunner::initAggregators() reorderAggregators(); } -void AggregatorRunner::initInfoLogger(InitContext& iCtx) -{ - // TODO : the method should be merged with the other, similar, methods in *Runners - - InfoLoggerContext* ilContext = nullptr; - AliceO2::InfoLogger::InfoLogger* il = nullptr; - try { - ilContext = &iCtx.services().get(); - il = &iCtx.services().get(); - } catch (const RuntimeErrorRef& err) { - ILOG(Error) << "Could not find the DPL InfoLogger." << ENDM; - } - - mRunnerConfig.infologgerDiscardParameters.discardFile = templateILDiscardFile(mRunnerConfig.infologgerDiscardParameters.discardFile, iCtx); - QcInfoLogger::init("aggregator", - mRunnerConfig.infologgerDiscardParameters, - il, - ilContext); -} - void AggregatorRunner::initLibraries() { std::set moduleNames; diff --git a/Framework/src/CheckRunner.cxx b/Framework/src/CheckRunner.cxx index 73327f8635..82775edfd7 100644 --- a/Framework/src/CheckRunner.cxx +++ b/Framework/src/CheckRunner.cxx @@ -212,7 +212,7 @@ void CheckRunner::refreshConfig(InitContext& iCtx) void CheckRunner::init(framework::InitContext& iCtx) { try { - initInfologger(iCtx); + core::initInfologger(iCtx, mConfig.infologgerDiscardParameters, createCheckRunnerFacility(mDeviceName)); refreshConfig(iCtx); Bookkeeping::getInstance().init(mConfig.bookkeepingUrl); initDatabase(); @@ -497,26 +497,6 @@ void CheckRunner::initServiceDiscovery() ILOG(Info, Support) << "ServiceDiscovery initialized" << ENDM; } -void CheckRunner::initInfologger(framework::InitContext& iCtx) -{ - // TODO : the method should be merged with the other, similar, methods in *Runners - - InfoLoggerContext* ilContext = nullptr; - AliceO2::InfoLogger::InfoLogger* il = nullptr; - try { - ilContext = &iCtx.services().get(); - il = &iCtx.services().get(); - } catch (const RuntimeErrorRef& err) { - ILOG(Error) << "Could not find the DPL InfoLogger." << ENDM; - } - - mConfig.infologgerDiscardParameters.discardFile = templateILDiscardFile(mConfig.infologgerDiscardParameters.discardFile, iCtx); - QcInfoLogger::init(createCheckRunnerFacility(mDeviceName), - mConfig.infologgerDiscardParameters, - il, - ilContext); -} - void CheckRunner::initLibraries() { std::set moduleNames; diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index 9cd97fa4e8..3029eb4957 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -117,30 +117,9 @@ void TaskRunner::refreshConfig(InitContext& iCtx) } } -void TaskRunner::initInfologger(InitContext& iCtx) -{ - // TODO : the method should be merged with the other, similar, methods in *Runners - - AliceO2::InfoLogger::InfoLoggerContext* ilContext = nullptr; - AliceO2::InfoLogger::InfoLogger* il = nullptr; - try { - ilContext = &iCtx.services().get(); - il = &iCtx.services().get(); - } catch (const RuntimeErrorRef& err) { - ILOG(Error, Devel) << "Could not find the DPL InfoLogger" << ENDM; - } - - mTaskConfig.infologgerDiscardParameters.discardFile = templateILDiscardFile(mTaskConfig.infologgerDiscardParameters.discardFile, iCtx); - QcInfoLogger::init("task/" + mTaskConfig.taskName, - mTaskConfig.infologgerDiscardParameters, - il, - ilContext); - QcInfoLogger::setDetector(mTaskConfig.detectorName); -} - void TaskRunner::init(InitContext& iCtx) { - initInfologger(iCtx); + core::initInfologger(iCtx, mTaskConfig.infologgerDiscardParameters, "task/" + mTaskConfig.taskName, mTaskConfig.detectorName); ILOG(Info, Devel) << "Initializing TaskRunner" << ENDM; refreshConfig(iCtx); diff --git a/Framework/src/runnerUtils.cxx b/Framework/src/runnerUtils.cxx index a6421de4a8..d1e4cc9af5 100644 --- a/Framework/src/runnerUtils.cxx +++ b/Framework/src/runnerUtils.cxx @@ -152,4 +152,25 @@ uint64_t getCurrentTimestamp() return value.count(); } +void initInfologger(framework::InitContext& iCtx, core::DiscardFileParameters infologgerDiscardParameters, std::string facility, std::string detectorName) +{ + AliceO2::InfoLogger::InfoLoggerContext* ilContext = nullptr; + AliceO2::InfoLogger::InfoLogger* il = nullptr; + try { + ilContext = &iCtx.services().get(); + il = &iCtx.services().get(); + } catch (const framework::RuntimeErrorRef& err) { + ILOG(Error, Devel) << "Could not find the DPL InfoLogger" << ENDM; + } + + infologgerDiscardParameters.discardFile = templateILDiscardFile(infologgerDiscardParameters.discardFile, iCtx); + QcInfoLogger::init(facility, + infologgerDiscardParameters, + il, + ilContext); + if (!detectorName.empty()) { + QcInfoLogger::setDetector(detectorName); + } +} + } // namespace o2::quality_control::core \ No newline at end of file