From dfcae619cff4cac6631fca18f276edff4f624549 Mon Sep 17 00:00:00 2001
From: James Turner <zakalawe@mac.com>
Date: Thu, 29 Oct 2020 13:44:52 +0000
Subject: [PATCH] Crude startup logging.

To diagnose startup hang, will revert once we have fix the issue.
---
 src/Main/bootstrap.cxx | 5 +++++
 src/Main/main.cxx      | 9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/Main/bootstrap.cxx b/src/Main/bootstrap.cxx
index b1690ac85..e5fde2107 100644
--- a/src/Main/bootstrap.cxx
+++ b/src/Main/bootstrap.cxx
@@ -288,6 +288,8 @@ int main ( int argc, char **argv )
     if (flightgear::Options::checkForArg(argc, argv, "uninstall")) {
         return fgUninstall();
     }
+    
+    std::cerr << "Boostrap-1" << std::endl;
 
     bool fgviewer = flightgear::Options::checkForArg(argc, argv, "fgviewer");
     int exitStatus = EXIT_FAILURE;
@@ -307,6 +309,9 @@ int main ( int argc, char **argv )
 #endif
         std::set_terminate(fg_terminate);
         atexit(fgExitCleanup);
+        
+        std::cerr << "Boostrap-2" << std::endl;
+
         if (fgviewer) {
             exitStatus = fgviewerMain(argc, argv);
         } else {
diff --git a/src/Main/main.cxx b/src/Main/main.cxx
index dea294dfa..493b81067 100755
--- a/src/Main/main.cxx
+++ b/src/Main/main.cxx
@@ -521,7 +521,9 @@ static void rotateOldLogFiles()
     if (!p.exists())
         return;
     SGPath log0Path = homePath / "fgfs_0.log";
-    p.rename(log0Path);
+    if (!p.rename(log0Path)) {
+        std::cerr << "Failed to rename " << p.str() << " to " << log0Path.str() << std::endl;
+    }
 }
 
 static void logToHome(const std::string& pri)
@@ -558,6 +560,9 @@ int fgMainInit( int argc, char **argv )
                                 "Flightgear was unable to create the lock file in FG_HOME");
     }
     
+    std::cerr << "DidInitHome" << std::endl;
+
+    
 #if defined(HAVE_QT)
     flightgear::initApp(argc, argv);
 #endif
@@ -587,10 +592,12 @@ int fgMainInit( int argc, char **argv )
         // now home is initialised, we can log to a file inside it
         const auto level = flightgear::Options::getArgValue(argc, argv, "--log-level");
         logToHome(level);
+        std::cerr << "DidLogToHome" << std::endl;
     }
 
     if (readOnlyFGHome) {
         flightgear::addSentryTag("fghome-readonly", "true");
+        std::cerr << "Read-Only-Home" << std::endl;
     }
 
     std::string version(FLIGHTGEAR_VERSION);