From 0893b49ebdd5c072f099ab7a9aa75d106c0c439b Mon Sep 17 00:00:00 2001
From: Aura Linden <aura@lindenlab.com>
Date: Mon, 24 Mar 2014 22:44:51 -0700
Subject: [PATCH] The simple approach has not worked.  This hybrid solution
 should avoid the Windows issues and get us per-run logfiles.

---
 indra/llcrashlogger/llcrashlogger.cpp           | 2 +-
 indra/newview/llappviewer.cpp                   | 7 +++++++
 indra/win_crash_logger/llcrashloggerwindows.cpp | 6 +++++-
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp
index 9bad47f12d..13c80d22fe 100755
--- a/indra/llcrashlogger/llcrashlogger.cpp
+++ b/indra/llcrashlogger/llcrashlogger.cpp
@@ -218,7 +218,7 @@ void LLCrashLogger::gatherFiles()
 	{
 		// Figure out the filename of the second life log
 		LLCurl::setCAFile(gDirUtilp->getCAFile());
-		mFileMap["SecondLifeLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.old");
+		mFileMap["SecondLifeLog"] = gDirUtilp->getExpandedFilename(LL_PATH_DUMP,"SecondLife.log");
 		mFileMap["SettingsXml"] = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"settings.xml");
 	}
 
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index d2e4136b9b..817ae9e2d2 100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -725,6 +725,13 @@ LLAppViewer::~LLAppViewer()
 	
 	destroyMainloopTimeout();
 
+#if !LL_WINDOWS
+    //Last thing, let's copy SL.log into the per-run directory.   We don't care if this operation fails.
+    std::string per_run_log = gDirUtilp->getExpandedFilename(LL_PATH_DUMP,"SecondLife.log");
+    std::string current_log = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.log");
+    LLFile::copy(per_run_log, current_log);
+#endif
+    
 	// If we got to this destructor somehow, the app didn't hang.
 	removeMarkerFiles();
 }
diff --git a/indra/win_crash_logger/llcrashloggerwindows.cpp b/indra/win_crash_logger/llcrashloggerwindows.cpp
index e3356f90ba..0e683c82bd 100644
--- a/indra/win_crash_logger/llcrashloggerwindows.cpp
+++ b/indra/win_crash_logger/llcrashloggerwindows.cpp
@@ -319,7 +319,11 @@ int LLCrashLoggerWindows::processingLoop() {
     }
     
     llinfos << "session ending.." << llendl;
-        
+    
+    LLSD options = getOptionData( LLApp::PRIORITY_COMMAND_LINE );
+    std::string per_run_file = options["dumpdir"].asString() + "SecondLife.log";
+    std::string log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.log");
+    LLFile::copy(per_run_file, log_file);
 	return 0;
 }
 
-- 
GitLab