View previous topic :: View next topic |
Author |
Message |
MagnumMan
Joined: 01 Apr 2005 Posts: 8 Location: MA
|
Posted: Sun Apr 10, 2005 4:04 Post subject: Better Log Rotation |
|
|
The log rotator is hardcoded only to move a few files. I changed it to move any .txt file instead:
Code: | // Create youngest directory '1'
CreateDirectory(oldDirName, NULL);
// Move current log files to '1'... new code
sprintf(tmpFileName, "%s*.txt", baseDirName);
WIN32_FIND_DATA wfd;
HANDLE h_find = FindFirstFile(tmpFileName, &wfd);
while (h_find != INVALID_HANDLE_VALUE) {
sprintf(oldDirName, "%s%s" , baseDirName, wfd.cFileName);
sprintf(newDirName, "%s1\\%s", baseDirName, wfd.cFileName);
MoveFile(oldDirName, newDirName);
if (!FindNextFile(h_find, &wfd)) {
FindClose(h_find);
h_find = INVALID_HANDLE_VALUE;
}
}
} |
|
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Tue Apr 12, 2005 8:58 Post subject: |
|
|
Thanks for the code (and for your email I have not managed to answer yet). I will include this in the next version! _________________ Papillon |
|
Back to top |
|
|
Remy
Joined: 20 Jan 2005 Posts: 6
|
Posted: Sat Apr 16, 2005 16:55 Post subject: |
|
|
Could you also make log subdirectory rotation depth (currently is 9?) as a user accessible configuration parameter? |
|
Back to top |
|
|
Senalaya
Joined: 29 Dec 2004 Posts: 82 Location: Germany
|
Posted: Sat Apr 16, 2005 23:30 Post subject: |
|
|
While we are at it
What about an alternate option, that allows an endless (manual maintained) log list with a timestamp ("YYYY-MM-DD--hh-mm-ss") as directory name? |
|
Back to top |
|
|
|