From b5d12b8aa57f12a880d7ee5a3410e9700878a994 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Tue, 4 Mar 2025 10:40:31 +0000 Subject: [PATCH] fix: Move version print line after file outputter is created --- src/apps/deskflow-daemon/deskflow-daemon.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/apps/deskflow-daemon/deskflow-daemon.cpp b/src/apps/deskflow-daemon/deskflow-daemon.cpp index 2c03f28ec..c5389a205 100644 --- a/src/apps/deskflow-daemon/deskflow-daemon.cpp +++ b/src/apps/deskflow-daemon/deskflow-daemon.cpp @@ -44,8 +44,6 @@ int main(int argc, char **argv) Log log; EventQueue events; - LOG((CLOG_PRINT "%s daemon (v%s)", kAppName, kVersion)); - auto &daemon = DaemonApp::instance(); DaemonApp::InitResult initResult; try { @@ -58,6 +56,13 @@ int main(int argc, char **argv) return kExitFailed; } + // Important: Log the app name and version number to the log file after the daemon app init + // because the file log outputter is created there. Logging before would only log to stdout + // which is not useful for troubleshooting Windows services. + // It's important to write the version number to the log file so we can be certain the old daemon + // was uninstalled, since sometimes Windows services can get stuck and fail to be removed. + LOG_PRINT("%s Daemon (v%s)", kAppName, kVersion); + switch (initResult) { using enum DaemonApp::InitResult;