]> granicus.if.org Git - icinga2/commitdiff
Improve logging for the WorkQueue class
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 9 Aug 2016 10:39:07 +0000 (12:39 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 9 Aug 2016 10:39:07 +0000 (12:39 +0200)
fixes #12336

lib/base/workqueue.cpp
lib/cli/daemoncommand.cpp
lib/cli/daemonutility.cpp

index 9a74557c1df3b26975b38b5ac8df2df49b66268a..c7b62caa11446afa3aa8291d29fbc1e680ca9da9 100644 (file)
@@ -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 << "'";
        }
 }
 
index 9463f11ef7012c7c7a5a350c4651e3cff77750c1..f9777896c1946fe88024d85c6dda8ea5a283e1c6 100644 (file)
@@ -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)) {
index 4d45ce6f1fd196004409168c7af9f0bd8215fb5e..1b6d8a843ba295bf133677957106b5dc0bc532b9 100644 (file)
@@ -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) {