Changed: #991 Make sure all debug files are created in log directory

This commit is contained in:
kervala 2010-06-21 21:03:21 +02:00
parent d089919c2f
commit 721a429cbc
13 changed files with 41 additions and 42 deletions

View file

@ -669,7 +669,9 @@ void CMsgBoxDisplayer::doDisplay ( const CLog::TDisplayInfo& args, const char *m
{
// yoyo: allow only to send the crash report once. Because users usually click ignore,
// which create noise into list of bugs (once a player crash, it will surely continues to do it).
if (ReportDebug == report (args.ProcessName + " NeL " + toString(logTypeToString(args.LogType, true)), "", subject, body, true, 2, true, 1, !isCrashAlreadyReported(), IgnoreNextTime, NL_CRASH_DUMP_FILE))
std::string filename = getLogDirectory() + NL_CRASH_DUMP_FILE;
if (ReportDebug == report (args.ProcessName + " NeL " + toString(logTypeToString(args.LogType, true)), "", subject, body, true, 2, true, 1, !isCrashAlreadyReported(), IgnoreNextTime, filename.c_str()))
{
INelContext::getInstance().setDebugNeedAssert(true);
}

View file

@ -95,8 +95,8 @@ static CTcpSock CrashCounterSock;
void quitCrashReport ()
{
if (NLMISC::CFile::fileExists("ryzom_started"))
CFile::deleteFile ("ryzom_started");
if (NLMISC::CFile::fileExists(getLogDirectory() + "ryzom_started"))
CFile::deleteFile (getLogDirectory() + "ryzom_started");
// must disconnect now, else could crash at dtor time because nldebug -> access a new INelContext()
contReset(CrashCounterSock);
}
@ -285,7 +285,7 @@ INT_PTR CALLBACK ReportDialogProc(
void initCrashReport ()
{
//
bool crashed = CFile::isExists ("ryzom_started");
bool crashed = CFile::isExists (getLogDirectory() + "ryzom_started");
bool during_release = false;
bool exception_catched = false;
bool breakpointed = false;
@ -293,22 +293,21 @@ void initCrashReport ()
bool report_failed = false;
bool report_refused = false;
bool report_sent = false;
if (crashed && CFile::isExists ("during_release"))
during_release = CFile::getFileModificationDate ("ryzom_started") <= CFile::getFileModificationDate ("during_release");
if (crashed && CFile::isExists ("exception_catched"))
exception_catched = CFile::getFileModificationDate ("ryzom_started") <= CFile::getFileModificationDate ("exception_catched");
if (crashed && CFile::isExists ("breakpointed"))
breakpointed = CFile::getFileModificationDate ("ryzom_started") <= CFile::getFileModificationDate ("breakpointed");
if (crashed && CFile::isExists ("nel_debug.dmp"))
dumped = CFile::getFileModificationDate ("ryzom_started") <= CFile::getFileModificationDate ("nel_debug.dmp");
if (crashed && CFile::isExists ("report_failed"))
report_failed = CFile::getFileModificationDate ("ryzom_started") <= CFile::getFileModificationDate ("report_failed");
if (crashed && CFile::isExists ("report_refused"))
report_refused = CFile::getFileModificationDate ("ryzom_started") <= CFile::getFileModificationDate ("report_refused");
if (crashed && CFile::isExists ("report_sent"))
report_sent = CFile::getFileModificationDate ("ryzom_started") <= CFile::getFileModificationDate ("report_sent");
FILE *file = fopen ("ryzom_started", "wb");
fclose (file);
if (crashed && CFile::isExists (getLogDirectory() + "during_release"))
during_release = CFile::getFileModificationDate (getLogDirectory() + "ryzom_started") <= CFile::getFileModificationDate (getLogDirectory() + "during_release");
if (crashed && CFile::isExists (getLogDirectory() + "exception_catched"))
exception_catched = CFile::getFileModificationDate (getLogDirectory() + "ryzom_started") <= CFile::getFileModificationDate (getLogDirectory() + "exception_catched");
if (crashed && CFile::isExists (getLogDirectory() + "breakpointed"))
breakpointed = CFile::getFileModificationDate ("ryzom_started") <= CFile::getFileModificationDate (getLogDirectory() + "breakpointed");
if (crashed && CFile::isExists (getLogDirectory() + "nel_debug.dmp"))
dumped = CFile::getFileModificationDate (getLogDirectory() + "ryzom_started") <= CFile::getFileModificationDate (getLogDirectory() + "nel_debug.dmp");
if (crashed && CFile::isExists (getLogDirectory() + "report_failed"))
report_failed = CFile::getFileModificationDate (getLogDirectory() + "ryzom_started") <= CFile::getFileModificationDate (getLogDirectory() + "report_failed");
if (crashed && CFile::isExists (getLogDirectory() + "report_refused"))
report_refused = CFile::getFileModificationDate (getLogDirectory() + "ryzom_started") <= CFile::getFileModificationDate (getLogDirectory() + "report_refused");
if (crashed && CFile::isExists (getLogDirectory() + "report_sent"))
report_sent = CFile::getFileModificationDate (getLogDirectory() + "ryzom_started") <= CFile::getFileModificationDate (getLogDirectory() + "report_sent");
CFile::createEmptyFile(getLogDirectory() + "ryzom_started");
connect();
if (report_sent)
send("/?crashtype=REPORT_SENT");
@ -580,8 +579,7 @@ int main(int argc, char **argv)
//ICommand::execute("iFileAccessLogClear",*NLMISC::InfoLog);
#endif
FILE *file = fopen ("during_release", "wb");
fclose (file);
CFile::createEmptyFile(getLogDirectory() + "during_release");
#ifdef TEST_CRASH_COUNTER
if (string(cmdline) == "/release")

View file

@ -376,7 +376,7 @@ NLMISC_COMMAND(bugReport, "Call the bug report tool with dump", "<AddScreenshot>
CBitmap btm;
Driver->getBuffer(btm);
string filename = CFile::findNewFile ("screenshot.jpg");
string filename = CFile::findNewFile (getLogDirectory() + "screenshot.jpg");
COFile fs(filename);
btm.writeJPG(fs, quality);
sys += "AttachedFile "+filename+" ";
@ -390,7 +390,7 @@ NLMISC_COMMAND(bugReport, "Call the bug report tool with dump", "<AddScreenshot>
if (ClientCfg.Local)
sys += "ShardName OFFLINE ";
FILE *fp = fopen ("bug_report.txt", "wb");
FILE *fp = fopen (std::string(getLogDirectory() + "bug_report.txt").c_str(), "wb");
if (fp != NULL)
{
string res = addSlashR(getDebugInformation());

View file

@ -179,7 +179,7 @@ void CEntityAnimationManager::load(NLMISC::IProgressCallback &/* progress */, bo
release();
// Log in the animation file.
setDebugOutput("animation.dbg");
setDebugOutput(getLogDirectory() + "animation.dbg");
// Create the animation set for all entities.
_AnimationSet = Driver->createAnimationSet();

View file

@ -168,7 +168,7 @@ const std::string& CLoginStateMachine::toString(CLoginStateMachine::TEvent event
{ \
COFile outputF; \
string sLog = NLMISC::toString("[%s] %s -> %s\n", CLoginStateMachine::toString(ev).c_str(), CLoginStateMachine::toString(_CurrentState).c_str(), CLoginStateMachine::toString(stateId).c_str()); \
if ( outputF.open( "error_join.log", true, true ) ) \
if ( outputF.open( getLogDirectory() + "error_join.log", true, true ) ) \
{ \
outputF.serialBuffer( (uint8*)(&sLog[0]), (uint)sLog.size() ); \
outputF.close(); \
@ -903,7 +903,7 @@ retryJoinEdit:
try
{
COFile outputF;
if ( outputF.open( "error_join.log", true, true ) )
if ( outputF.open( getLogDirectory() + "error_join.log", true, true ) )
{
time_t currentTime;
time( &currentTime );

View file

@ -702,7 +702,7 @@ void prelogInit()
// Client.Log displayer
nlassert( !ErrorLog->getDisplayer("CLIENT.LOG") );
CFileDisplayer *ClientLogDisplayer = new CFileDisplayer("client.log", true, "CLIENT.LOG");
CFileDisplayer *ClientLogDisplayer = new CFileDisplayer(getLogDirectory() + "client.log", true, "CLIENT.LOG");
DebugLog->addDisplayer (ClientLogDisplayer);
InfoLog->addDisplayer (ClientLogDisplayer);
WarningLog->addDisplayer (ClientLogDisplayer);

View file

@ -1306,7 +1306,7 @@ void initMainLoop()
// Display and save profile to a File.
CLog log;
CFileDisplayer fileDisplayer(NLMISC::CFile::findNewFile("profile_startup.log"));
CFileDisplayer fileDisplayer(NLMISC::CFile::findNewFile(getLogDirectory() + "profile_startup.log"));
log.addDisplayer(&fileDisplayer);
// display
NLMISC::CHTimer::displayHierarchicalByExecutionPathSorted(&log, CHTimer::TotalTime, true, 48, 2);

View file

@ -151,7 +151,7 @@ class CAHProfileTexture : public IActionHandler
// Display and save profile to a File.
CLog log;
CFileDisplayer fileDisplayer(NLMISC::CFile::findNewFile("texture.log"));
CFileDisplayer fileDisplayer(NLMISC::CFile::findNewFile(getLogDirectory() + "texture.log"));
CStdDisplayer stdDisplayer;
log.addDisplayer(&fileDisplayer);
log.addDisplayer(&stdDisplayer);

View file

@ -677,7 +677,7 @@ bool CInterfaceParser::parseInterface (const std::vector<std::string> & strings,
NLMISC::CHTimer::endBench();
// Display and save profile to a File.
CLog log;
CFileDisplayer fileDisplayer(NLMISC::CFile::findNewFile("profile_parseInterface.log"));
CFileDisplayer fileDisplayer(NLMISC::CFile::findNewFile(getLogDirectory() + "profile_parseInterface.log"));
log.addDisplayer(&fileDisplayer);
// diplay
NLMISC::CHTimer::displayHierarchicalByExecutionPathSorted(&log, CHTimer::TotalTime, true, 48, 2);

View file

@ -206,7 +206,7 @@ void createOptionalCatUI()
void initEula()
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (!ClientCfg.SkipEULA && CFile::fileExists("show_eula"))
if (!ClientCfg.SkipEULA && CFile::fileExists(getLogDirectory() + "show_eula"))
{
pIM->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_EULA);
@ -599,9 +599,7 @@ void loginMainLoop()
// the patcher to overwrite them)
// create a file to prompt eula next time
FILE *file = fopen ("show_eula", "wb");
fclose (file);
CFile::createEmptyFile(getLogDirectory() + "show_eula");
if (taskResult == BGDownloader::TaskResult_Error)
{
@ -1707,9 +1705,10 @@ class CAHReboot : public IActionHandler
virtual void execute (CCtrlBase * /* pCaller */, const string &/* sParams */)
{
nlinfo("CAHReboot called");
// create a file to prompt eula next time
FILE *file = fopen ("show_eula", "wb");
fclose (file);
CFile::createEmptyFile(getLogDirectory() + "show_eula");
CInterfaceManager *im = CInterfaceManager::getInstance();
try
{
@ -1747,7 +1746,7 @@ class CAHAcceptEula : public IActionHandler
virtual void execute (CCtrlBase * /* pCaller */, const string &/* sParams */)
{
nlinfo("CAHAcceptEula called");
CFile::deleteFile("show_eula");
CFile::deleteFile(getLogDirectory() + "show_eula");
LoginSM.pushEvent(CLoginStateMachine::ev_accept_eula);
// if (ClientCfg.R2Mode)

View file

@ -518,7 +518,7 @@ void testLaunchProfile()
// Display and save profile to a File.
CLog log;
CFileDisplayer fileDisplayer(NLMISC::CFile::findNewFile("profile.log"));
CFileDisplayer fileDisplayer(NLMISC::CFile::findNewFile(getLogDirectory() + "profile.log"));
CStdDisplayer stdDisplayer;
log.addDisplayer(&fileDisplayer);
log.addDisplayer(&stdDisplayer);

View file

@ -133,7 +133,7 @@ void initReceiveLog()
{
try
{
ReceiveLogDisp = new CFileDisplayer( "ReceiveLog.log" );
ReceiveLogDisp = new CFileDisplayer( getLogDirectory() + "ReceiveLog.log" );
ReceiveLogger.addDisplayer( ReceiveLogDisp );
//ReceiveLogger.displayNL( "Searching for param LogReceive in the config file..." );
NCConfigFile.load( string( "client.cfg" ) );

View file

@ -598,7 +598,7 @@ void CSheetManager::release()
void CSheetManager::load(NLMISC::IProgressCallback &callBack, bool updatePackedSheet, bool needComputeVS, bool dumpVSIndex)
{
// Open The Item Association File
if(!fItemAssoc.open("item_association.dbg", false, true))
if(!fItemAssoc.open(getLogDirectory() + "item_association.dbg", false, true))
nlwarning("CSheetManager::load: Cannot Open the 'item_association.txt'.");
else
ItemAssocFileOpen = true;
@ -1020,7 +1020,7 @@ void CSheetManager::dumpVisualSlots()
// ***************************************************************************
void CSheetManager::dumpVisualSlotsIndex()
{
FILE * vsIndexFile = fopen("vs_index.txt","w");
FILE * vsIndexFile = fopen(std::string(getLogDirectory() + "vs_index.txt").c_str(),"w");
if( vsIndexFile )
{
for (uint i=0; i < SLOTTYPE::NB_SLOT; ++i)