]> git.mxchange.org Git - flightgear.git/commitdiff
Log to file inside FG_HOME.
authorJames Turner <zakalawe@mac.com>
Wed, 6 Feb 2013 18:05:33 +0000 (19:05 +0100)
committerJames Turner <zakalawe@mac.com>
Thu, 7 Feb 2013 12:02:52 +0000 (12:02 +0000)
src/Main/main.cxx

index b51bd01a044c7a3cb630a6089feb2a8d9bbcecb3..e1b98d3c3febe0a591b285b2c1da5bbf5f1a4821 100644 (file)
@@ -313,6 +313,18 @@ int fgMainInit( int argc, char **argv ) {
       SG_LOG( SG_GENERAL, SG_ALERT, "Config option parsing failed ..." );
       exit(-1);
     }
+  
+    SGPath logPath = globals->get_fg_home();
+    logPath.append("fgfs.log");
+    if (logPath.exists()) {
+        SGPath prevLogPath = globals->get_fg_home();
+        prevLogPath.append("fgfs_0.log");
+        logPath.rename(prevLogPath);
+    // bit strange, we need to restore the correct value of logPath now
+        logPath = globals->get_fg_home();
+        logPath.append("fgfs.log");
+    }
+    sglog().logToFile(logPath, SG_ALL, SG_INFO);
 
     // Initialize the Window/Graphics environment.
     fgOSInit(&argc, argv);