logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Better Log Rotation

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
MagnumMan



Joined: 01 Apr 2005
Posts: 8
Location: MA

PostPosted: Sun Apr 10, 2005 4:04    Post subject: Better Log Rotation Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Tue Apr 12, 2005 8:58    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Remy



Joined: 20 Jan 2005
Posts: 6

PostPosted: Sat Apr 16, 2005 16:55    Post subject: Reply with quote

Could you also make log subdirectory rotation depth (currently is 9?) as a user accessible configuration parameter?
Back to top
View user's profile Send private message
Senalaya



Joined: 29 Dec 2004
Posts: 82
Location: Germany

PostPosted: Sat Apr 16, 2005 23:30    Post subject: Reply with quote

While we are at it Razz

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group