void Book::Error( const char *msg ) { cprintf( "Book::Error(%s)\n", msg ); #ifdef _DEBUG int i; char c; fprintf( debug_log_file(), "Error: %s\n", msg ); if( *desc ) fprintf( debug_log_file(), "%s\n", desc ); else fprintf( debug_log_file(), "%s-%s %s %s %s\n", white, black, date, site, event ); for( i=0; i<sizeof(error_buf); i++ ) { c = error_buf[error_ptr++]; error_ptr &= (sizeof(error_buf)-1); if( c ) fprintf( debug_log_file(), "%c", c ); } fprintf( debug_log_file(), "\n" ); for( i=0; i<nbrof(debug_buf); i++ ) { c = debug_buf[debug_ptr].c; STATE state = debug_buf[debug_ptr].state; debug_ptr++; debug_ptr &= (nbrof(debug_buf)-1); if( c ) fprintf( debug_log_file(), "[%s]%c", ShowState(state), c ); } #endif }
void Book::debug_dump() { int i; for( i=0; i<nbrof(debug_buf); i++ ) { char c = debug_buf[debug_ptr].c; STATE state = debug_buf[debug_ptr].state; debug_ptr++; debug_ptr &= (nbrof(debug_buf)-1); if( c ) fprintf( debug_log_file(), "[%s]%c", ShowState(state), c ); } }
bool LLCrashLogger::readDebugFromXML(LLSD& dest, const std::string& filename ) { std::string db_file_name = gDirUtilp->getExpandedFilename(LL_PATH_DUMP,filename); 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(dest, debug_log_file); debug_log_file.close(); return true; } return false; }
void LLCrashLogger::gatherFiles() { /* //TODO:This function needs to be reimplemented somewhere in here... if(!previous_crash && is_crash_log) { // Make sure the file isn't too old. double age = difftime(gLaunchTime, stat_data.st_mtimespec.tv_sec); // llinfos << "age is " << age << llendl; if(age > 60.0) { // The file was last modified more than 60 seconds before the crash reporter was launched. Assume it's stale. llwarns << "File " << mFilename << " is too old!" << llendl; return; } } */ updateApplication("Gathering logs..."); // 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); 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 LLCurl::setCAFile(gDirUtilp->getCAFile()); mFileMap["SecondLifeLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.log"); mFileMap["SettingsXml"] = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,"settings.xml"); } gatherPlatformSpecificFiles(); //Use the debug log to reconstruct the URL to send the crash report to if(mDebugLog.has("CurrentSimHost")) { mCrashHost = "https://"; mCrashHost += mDebugLog["CurrentSimHost"].asString(); mCrashHost += ":12043/crash/report"; } else if(mDebugLog.has("GridName")) { // This is a 'little' hacky, but its the best simple solution. std::string grid_host = mDebugLog["GridName"].asString(); LLStringUtil::toLower(grid_host); mCrashHost = "https://login."; mCrashHost += grid_host; mCrashHost += ".lindenlab.com:12043/crash/report"; } // Use login servers as the alternate, since they are already load balanced and have a known name mAltCrashHost = "https://login.agni.lindenlab.com:12043/crash/report"; mCrashInfo["DebugLog"] = mDebugLog; mFileMap["StatsLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stats.log"); mFileMap["StackTrace"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stack_trace.log"); updateApplication("Encoding files..."); for(std::map<std::string, std::string>::iterator itr = mFileMap.begin(); itr != mFileMap.end(); ++itr) { std::ifstream f((*itr).second.c_str()); if(!f.is_open()) { std::cout << "Can't find file " << (*itr).second << std::endl; continue; } std::stringstream s; s << f.rdbuf(); std::string crash_info = s.str(); if(itr->first == "SecondLifeLog") { trimSLLog(crash_info); } mCrashInfo[(*itr).first] = crash_info; } }