Author

Topic: debug.log getting bigger (Read 2258 times)

administrator
Activity: 5222
Merit: 13032
May 22, 2011, 02:06:50 PM
#7
eh?  No, it does not truncate debug.log at startup.

util.cpp:
Code:
void ShrinkDebugFile()
{
    // Scroll debug.log if it's getting too big
    string strFile = GetDataDir() + "/debug.log";
    FILE* file = fopen(strFile.c_str(), "r");
    if (file && GetFilesize(file) > 10 * 1000000)
    {
        // Restart the file with some of the end
        char pch[200000];
        fseek(file, -sizeof(pch), SEEK_END);
        int nBytes = fread(pch, 1, sizeof(pch), file);
        fclose(file);
        if (file = fopen(strFile.c_str(), "w"))
        {
            fwrite(pch, 1, nBytes, file);
            fclose(file);
        }
    }
}

init.cpp (at startup, just before writing the debug.log "header"):
Code:
    if (!fDebug && !pszSetDataDir[0])
        ShrinkDebugFile();
    printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
    printf("Bitcoin version %s%s beta\n", FormatVersion(VERSION).c_str(), pszSubVer);

This feature actually annoys me, since I like to archive my debug.log. (I've disabled it on mine.)
member
Activity: 98
Merit: 13
May 22, 2011, 11:18:25 AM
#6
I wish there was some command line option which would make bitcoind sending logs to stout or stderr instead of that stupid debug.log file.

Open an issue at github, this is a reasonable request.

member
Activity: 98
Merit: 13
May 22, 2011, 11:18:08 AM
#5
Bitcoin will truncate debug.log when you restart it.

eh?  No, it does not truncate debug.log at startup.

hero member
Activity: 812
Merit: 1001
-
May 22, 2011, 05:04:39 AM
#4
I wish there was some command line option which would make bitcoind sending logs to stout or stderr instead of that stupid debug.log file.
administrator
Activity: 5222
Merit: 13032
May 19, 2011, 09:00:55 PM
#3
Bitcoin will truncate debug.log when you restart it.
member
Activity: 98
Merit: 13
May 19, 2011, 07:08:27 PM
#2

There is one pull request along those lines.

full member
Activity: 177
Merit: 100
May 19, 2011, 03:53:32 PM
#1
Hi there,

is there a possibility to get bitcoind to not write that much (anything) to debug.log?
It gets kinda big.

Thanks
Jump to: