Bug #537

StdLogSetup() does not consider LOG_APPEND

Added by IƱaki Zabala about 8 years ago. Updated almost 8 years ago.

Status:ApprovedStart date:10/11/2013
Priority:HighDue date:
Assignee:Miroslav Fidler% Done:

0%

Category:CoreSpent time:-
Target version:-

Description

StdLogSetup() does not consider LOG_APPEND so every time this sample is run, log file is deleted.

CONSOLE_APP_MAIN
{
    StdLogSetup(LOG_FILE | LOG_APPEND, "Demo.txt");
    RLOG("Demo");
}

The problem could be in void LogOut::Create(bool append). Please see the commments:

void LogOut::Create(bool append)
{
    Close();

    char next[512];
    for(int rot = options >> 24; rot >= 0; rot--) {   // Now rot == options >> 24
        char current[512];
        if(rot == 0)
            strcpy(current, filepath);
        else
            sprintf(current, rot > 1 && (options & LOG_ROTATE_GZIP) ? "%s.%d.gzip" : "%s.%d",
                    filepath, rot);
        if(FileExists(current)) {
            if(rot == (options >> 24))   // As rot == options >> 24, older log file is deleted
                FileDelete(current);

History

#1 Updated by Miroslav Fidler almost 8 years ago

  • Priority changed from Normal to High

#2 Updated by Miroslav Fidler almost 8 years ago

  • Status changed from New to Approved

Also available in: Atom PDF