diff options
-rw-r--r-- | indra/llcommon/llerror.cpp | 37 | ||||
-rw-r--r-- | indra/llcommon/llerrorcontrol.h | 7 | ||||
-rw-r--r-- | indra/llcrashlogger/llcrashlogger.cpp | 2 | ||||
-rw-r--r-- | indra/llplugin/slplugin/slplugin.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 5 | ||||
-rw-r--r-- | indra/test/test.cpp | 4 |
6 files changed, 19 insertions, 38 deletions
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index e6407ecf22..2fe9775e10 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -312,7 +312,7 @@ namespace LOG_CLASS(LogControlFile); public: - static LogControlFile& fromDirectory(const std::string& dir); + static LogControlFile& fromDirectory(const std::string& user_dir, const std::string& app_dir); virtual bool loadFile(); @@ -322,13 +322,12 @@ namespace { } }; - LogControlFile& LogControlFile::fromDirectory(const std::string& dir) + LogControlFile& LogControlFile::fromDirectory(const std::string& user_dir, const std::string& app_dir) { - std::string dirBase = dir + "/"; - // NB: We have no abstraction in llcommon for the "proper" - // delimiter but it turns out that "/" works on all three platforms + // NB: We have no abstraction in llcommon for the "proper" + // delimiter but it turns out that "/" works on all three platforms - std::string file = dirBase + "logcontrol-dev.xml"; + std::string file = user_dir + "/logcontrol-dev.xml"; llstat stat_info; if (LLFile::stat(file, &stat_info)) { @@ -336,7 +335,7 @@ namespace // if it doesn't exist. LLFile has no better abstraction for // testing for file existence. - file = dirBase + "logcontrol.xml"; + file = app_dir + "/logcontrol.xml"; } return * new LogControlFile(file); // NB: This instance is never freed @@ -363,7 +362,7 @@ namespace } LLError::configure(configuration); - LL_INFOS() << "logging reconfigured from " << filename() << LL_ENDL; + LL_INFOS("LogControlFile") << "logging reconfigured from " << filename() << LL_ENDL; return true; } @@ -615,7 +614,7 @@ namespace } - void commonInit(const std::string& dir, bool log_to_stderr = true) + void commonInit(const std::string& user_dir, const std::string& app_dir, bool log_to_stderr = true) { LLError::Settings::getInstance()->reset(); @@ -635,7 +634,7 @@ namespace LLError::addRecorder(recordToWinDebug); #endif - LogControlFile& e = LogControlFile::fromDirectory(dir); + LogControlFile& e = LogControlFile::fromDirectory(user_dir, app_dir); // NOTE: We want to explicitly load the file before we add it to the event timer // that checks for changes to the file. Else, we're not actually loading the file yet, @@ -651,23 +650,9 @@ namespace namespace LLError { - void initForServer(const std::string& identity) + void initForApplication(const std::string& user_dir, const std::string& app_dir, bool log_to_stderr) { - std::string dir = "/opt/linden/etc"; - if (LLApp::instance()) - { - dir = LLApp::instance()->getOption("configdir").asString(); - } - commonInit(dir); -#if !LL_WINDOWS - LLError::RecorderPtr recordToSyslog(new RecordToSyslog(identity)); - addRecorder(recordToSyslog); -#endif - } - - void initForApplication(const std::string& dir, bool log_to_stderr) - { - commonInit(dir, log_to_stderr); + commonInit(user_dir, app_dir, log_to_stderr); } void setPrintLocation(bool print) diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h index 56e84f7172..caf2ba72c2 100644 --- a/indra/llcommon/llerrorcontrol.h +++ b/indra/llcommon/llerrorcontrol.h @@ -60,12 +60,7 @@ public: namespace LLError { - LL_COMMON_API void initForServer(const std::string& identity); - // resets all logging settings to defaults needed by server processes - // logs to stderr, syslog, and windows debug log - // the identity string is used for in the syslog - - LL_COMMON_API void initForApplication(const std::string& dir, bool log_to_stderr = true); + LL_COMMON_API void initForApplication(const std::string& user_dir, const std::string& app_dir, bool log_to_stderr = true); // resets all logging settings to defaults needed by applicaitons // logs to stderr and windows debug log // sets up log configuration from the file logcontrol.xml in dir diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index dca49be051..9bd142aacc 100644 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -566,7 +566,7 @@ bool LLCrashLogger::init() // We assume that all the logs we're looking for reside on the current drive gDirUtilp->initAppDirs("SecondLife"); - LLError::initForApplication(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "")); + LLError::initForApplication(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, ""), gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "")); // Default to the product name "Second Life" (this is overridden by the -name argument) mProductName = "Second Life"; diff --git a/indra/llplugin/slplugin/slplugin.cpp b/indra/llplugin/slplugin/slplugin.cpp index 684bcf1207..e45d9ab19a 100644 --- a/indra/llplugin/slplugin/slplugin.cpp +++ b/indra/llplugin/slplugin/slplugin.cpp @@ -185,7 +185,7 @@ int main(int argc, char **argv) // Set up llerror logging { - LLError::initForApplication("."); + LLError::initForApplication(".","."); LLError::setDefaultLevel(LLError::LEVEL_INFO); // LLError::setTagLevel("Plugin", LLError::LEVEL_DEBUG); // LLError::logToFile("slplugin.log"); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index d0c7d0b72e..86bf44567d 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2206,8 +2206,9 @@ void LLAppViewer::initLoggingAndGetLastDuration() // // Set up logging defaults for the viewer // - LLError::initForApplication( - gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "")); + LLError::initForApplication( gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "") + ,gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "") + ); LLError::setFatalFunction(errorCallback); //LLError::setTimeFunction(getRuntime); diff --git a/indra/test/test.cpp b/indra/test/test.cpp index e42374d56b..83b22c9011 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -525,12 +525,12 @@ int main(int argc, char **argv) const char* LOGTEST = getenv("LOGTEST"); if (LOGTEST) { - LLError::initForApplication(".", true /* log to stderr */); + LLError::initForApplication(".", ".", true /* log to stderr */); LLError::setDefaultLevel(LLError::decodeLevel(LOGTEST)); } else { - LLError::initForApplication(".", false /* do not log to stderr */); + LLError::initForApplication(".", ".", false /* do not log to stderr */); LLError::setDefaultLevel(LLError::LEVEL_DEBUG); } LLError::setFatalFunction(wouldHaveCrashed); |