From 7519d23892c3478148ff297d63cc535a88dfc382 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 19 Jul 2018 13:34:12 +0200 Subject: [PATCH] Add debug logging for daemonize/timers The previous commit is 1:1 the same I've implemented here already. Great teamwork with Alex :) refs #6445 --- lib/base/application.cpp | 4 ++-- lib/base/timer.cpp | 3 +++ lib/cli/daemoncommand.cpp | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/base/application.cpp b/lib/base/application.cpp index cfa728caa..4287c7687 100644 --- a/lib/base/application.cpp +++ b/lib/base/application.cpp @@ -138,9 +138,10 @@ void Application::InitializeBase() Loader::ExecuteDeferredInitializers(); - /* make sure the thread pool gets initialized */ + /* Make sure the thread pool gets initialized. */ GetTP().Start(); + /* Make sure the timer thread gets initialized. */ Timer::Initialize(); } @@ -302,7 +303,6 @@ void Application::SetArgV(char **argv) */ void Application::RunEventLoop() { - #ifdef HAVE_SYSTEMD sd_notify(0, "READY=1"); #endif /* HAVE_SYSTEMD */ diff --git a/lib/base/timer.cpp b/lib/base/timer.cpp index 95e3f5b6d..65c7ee626 100644 --- a/lib/base/timer.cpp +++ b/lib/base/timer.cpp @@ -19,6 +19,7 @@ #include "base/timer.hpp" #include "base/debug.hpp" +#include "base/logger.hpp" #include "base/utility.hpp" #include #include @@ -259,6 +260,8 @@ void Timer::AdjustTimers(double adjustment) */ void Timer::TimerThreadProc() { + Log(LogDebug, "Timer", "TimerThreadProc started."); + Utility::SetThreadName("Timer Thread"); for (;;) { diff --git a/lib/cli/daemoncommand.cpp b/lib/cli/daemoncommand.cpp index f663d1046..ba2dade47 100644 --- a/lib/cli/daemoncommand.cpp +++ b/lib/cli/daemoncommand.cpp @@ -88,6 +88,9 @@ static bool Daemonize() _exit(EXIT_SUCCESS); } + Log(LogDebug, "Daemonize()") + << "Child process with PID " << Utility::GetPid() << " continues; re-initializing base."; + Application::InitializeBase(); #endif /* _WIN32 */ -- 2.40.0