[icinga-checkins] icinga.org: icinga2/master: Improve logging for the WorkQueue class

git at icinga.org git at icinga.org
Tue Aug 9 12:39:43 CEST 2016


Module: icinga2
Branch: master
Commit: f3bb628d6eff619537347591dd85a26c0e0cf35a
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=f3bb628d6eff619537347591dd85a26c0e0cf35a

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Tue Aug  9 12:39:07 2016 +0200

Improve logging for the WorkQueue class

fixes #12336

---

 lib/base/workqueue.cpp    |    6 ++++++
 lib/cli/daemoncommand.cpp |    1 +
 lib/cli/daemonutility.cpp |    1 +
 3 files changed, 8 insertions(+)

diff --git a/lib/base/workqueue.cpp b/lib/base/workqueue.cpp
index 9a74557..c7b62ca 100644
--- a/lib/base/workqueue.cpp
+++ b/lib/base/workqueue.cpp
@@ -79,6 +79,9 @@ void WorkQueue::Enqueue(const boost::function<void (void)>& function, WorkQueueP
 	boost::mutex::scoped_lock lock(m_Mutex);
 
 	if (!m_Spawned) {
+		Log(LogNotice, "WorkQueue")
+		    << "Spawning WorkQueue threads for '" << m_Name << "'";
+
 		for (int i = 0; i < m_ThreadCount; i++) {
 			m_Threads.create_thread(boost::bind(&WorkQueue::WorkerThreadProc, this));
 		}
@@ -116,6 +119,9 @@ void WorkQueue::Join(bool stop)
 
 		m_Threads.join_all();
 		m_Spawned = false;
+
+		Log(LogNotice, "WorkQueue")
+		    << "Stopped WorkQueue threads for '" << m_Name << "'";
 	}
 }
 
diff --git a/lib/cli/daemoncommand.cpp b/lib/cli/daemoncommand.cpp
index 9463f11..f977789 100644
--- a/lib/cli/daemoncommand.cpp
+++ b/lib/cli/daemoncommand.cpp
@@ -282,6 +282,7 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vector<std::strin
 
 	{
 		WorkQueue upq(25000, Application::GetConcurrency());
+		upq.SetName("DaemonCommand::Run");
 
 		// activate config only after daemonization: it starts threads and that is not compatible with fork()
 		if (!ConfigItem::ActivateItems(upq, newItems)) {
diff --git a/lib/cli/daemonutility.cpp b/lib/cli/daemonutility.cpp
index 4d45ce6..1b6d8a8 100644
--- a/lib/cli/daemonutility.cpp
+++ b/lib/cli/daemonutility.cpp
@@ -168,6 +168,7 @@ bool DaemonUtility::LoadConfigFiles(const std::vector<std::string>& configs,
 	}
 
 	WorkQueue upq(25000, Application::GetConcurrency());
+	upq.SetName("DaemonUtility::LoadConfigFiles");
 	bool result = ConfigItem::CommitItems(ascope.GetContext(), upq, newItems);
 
 	if (!result) {



More information about the icinga-checkins mailing list