From 94a2a1a98bb22c88c87a6f1d3f5beb6bdc471d87 Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Thu, 3 Jun 2010 18:21:06 -0700 Subject: Backed out renaming of log files (changeset 7357f4ef70df) executed: 'hg backout -r 7357f4ef70df --merge' --- indra/llcrashlogger/llcrashlogger.cpp | 88 ++++++++++++----------------------- indra/llcrashlogger/llcrashlogger.h | 1 - indra/newview/llappviewer.cpp | 30 +----------- 3 files changed, 32 insertions(+), 87 deletions(-) (limited to 'indra') diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index a91cf530b5..078795f962 100755 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -36,8 +36,6 @@ #include "llcrashlogger.h" #include "linden_common.h" -#include "lldate.h" -#include "llfile.h" #include "llstring.h" #include "indra_constants.h" // CRASH_BEHAVIOR_ASK, CRASH_SETTING_NAME #include "llerror.h" @@ -155,79 +153,54 @@ std::string getStartupStateFromLog(std::string& sllog) return startup_state; } -void LLCrashLogger::findAndRenameLogFiles() +void LLCrashLogger::gatherFiles() { - // Find and rename the relevant log files so they won't be stomped on if - // SL is restarted before user sends crash report. - - std::string now = "." + LLDate::now().asString(); - - std::string stats_log_original = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stats.log"); - std::string stats_log = stats_log_original; - stats_log.insert(stats_log.length() - 4, now); - if(LLFile::rename(stats_log_original, stats_log) == 0) - { - mFileMap["StatsLog"] = stats_log; - } - - std::string second_life_log_original; - std::string settings_file_original; + updateApplication("Gathering logs..."); - std::string db_file_name_original = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"debug_info.log"); - std::string db_file_name = db_file_name_original; - db_file_name.insert(db_file_name.length() - 4, now); - LLFile::rename(db_file_name_original, db_file_name); + // Figure out the filename of the debug log + std::string db_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"debug_info.log"); std::ifstream debug_log_file(db_file_name.c_str()); + + // Look for it in the debug_info.log file if (debug_log_file.is_open()) { - LLSDSerialize::fromXML(mDebugLog, debug_log_file); + LLSDSerialize::fromXML(mDebugLog, debug_log_file); + mCrashInPreviousExec = mDebugLog["CrashNotHandled"].asBoolean(); - second_life_log_original = mDebugLog["SLLog"].asString(); - settings_file_original = mDebugLog["SettingsFilename"].asString(); + + mFileMap["SecondLifeLog"] = mDebugLog["SLLog"].asString(); + mFileMap["SettingsXml"] = mDebugLog["SettingsFilename"].asString(); + if(mDebugLog.has("CAFilename")) + { + LLCurl::setCAFile(mDebugLog["CAFilename"].asString()); + } + else + { + LLCurl::setCAFile(gDirUtilp->getCAFile()); + } + + llinfos << "Using log file from debug log " << mFileMap["SecondLifeLog"] << llendl; + llinfos << "Using settings file from debug log " << mFileMap["SettingsXml"] << llendl; } else { // Figure out the filename of the second life log - second_life_log_original = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.log"); - settings_file_original = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"settings.xml"); + LLCurl::setCAFile(gDirUtilp->getCAFile()); + mFileMap["SecondLifeLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.log"); + mFileMap["SettingsXml"] = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"settings.xml"); } - + if(mCrashInPreviousExec) { // Restarting after freeze. // Replace the log file ext with .old, since the // instance that launched this process has overwritten // SecondLife.log - second_life_log_original.replace(second_life_log_original.size() - 4, 4, ".old"); + std::string log_filename = mFileMap["SecondLifeLog"]; + log_filename.replace(log_filename.size() - 4, 4, ".old"); + mFileMap["SecondLifeLog"] = log_filename; } - - std::string second_life_log = second_life_log_original; - std::string settings_file = settings_file_original; - second_life_log.insert(second_life_log.length() - 4, now); - settings_file.insert(settings_file.length() - 4, now); - if(LLFile::rename(second_life_log_original, second_life_log) == 0) - { - mFileMap["SecondLifeLog"] = second_life_log; - } - if(LLFile::rename(settings_file_original, settings_file) == 0) - { - mFileMap["SettingsXml"] = settings_file; - } -} - -void LLCrashLogger::gatherFiles() -{ - updateApplication("Gathering logs..."); - if(mDebugLog.has("CAFilename")) - { - LLCurl::setCAFile(mDebugLog["CAFilename"].asString()); - } - else - { - LLCurl::setCAFile(gDirUtilp->getCAFile()); - } - gatherPlatformSpecificFiles(); //Use the debug log to reconstruct the URL to send the crash report to @@ -257,6 +230,7 @@ void LLCrashLogger::gatherFiles() mAltCrashHost = "https://login.agni.lindenlab.com:12043/crash/report"; mCrashInfo["DebugLog"] = mDebugLog; + mFileMap["StatsLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stats.log"); updateApplication("Encoding files..."); @@ -431,7 +405,5 @@ bool LLCrashLogger::init() LLAPRFile::remove( marker_file ); } - findAndRenameLogFiles(); - return true; } diff --git a/indra/llcrashlogger/llcrashlogger.h b/indra/llcrashlogger/llcrashlogger.h index a3cb17a958..f8abe20597 100755 --- a/indra/llcrashlogger/llcrashlogger.h +++ b/indra/llcrashlogger/llcrashlogger.h @@ -48,7 +48,6 @@ public: S32 loadCrashBehaviorSetting(); void gatherFiles(); virtual void gatherPlatformSpecificFiles() {} - void findAndRenameLogFiles(); bool saveCrashBehaviorSetting(S32 crash_behavior); bool sendCrashLogs(); LLSD constructPostData(); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index a5343bb522..351c0cbae5 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -81,7 +81,7 @@ #include "llvoicechannel.h" #include "llvoavatarself.h" #include "llsidetray.h" -#include "lldate.h" + #include "llweb.h" #include "llsecondlifeurls.h" @@ -102,7 +102,6 @@ // Third party library includes #include -#include #if LL_WINDOWS @@ -1243,37 +1242,12 @@ bool LLAppViewer::cleanup() // workaround for DEV-35406 crash on shutdown LLEventPumps::instance().reset(); + // remove any old breakpad minidump files from the log directory if (! isError()) { - // remove any old breakpad minidump files from the log directory std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ""); logdir += gDirUtilp->getDirDelimiter(); gDirUtilp->deleteFilesInDir(logdir, "*-*-*-*-*.dmp"); - - // remove any old log files saved from old crash reports. - const static std::string mask = "*.*.log"; - std::string filename; - while (gDirUtilp->getNextFileInDir(logdir, mask, filename, false)) - { - static const boost::regex - file_regex(".*\\.(.*)\\.log", boost::regex::extended); - boost::smatch match; - if(boost::regex_match(filename, match, file_regex) && match.size() > 1) - { - F64 date = LLDate(match[1]).secondsSinceEpoch(); - F64 age = LLDate::now().secondsSinceEpoch() - date; - if( date > 0.0 && age > 604800.0 ) - { - // Clean up files older than 1 week. - llinfos << "removing old log file " << filename << llendl; - LLFile::remove(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, filename)); - } - } - else - { - // ignore; - } - } } // *TODO - generalize this and move DSO wrangling to a helper class -brad -- cgit v1.2.3