CFtpServer::RenameServerLogFile Method  
 
BOOL RenameServerLogFile(
  LPCTSTR lpszFileName  
);

Rename or delete the current log file being updated by the server.

Parameters

lpszFileName
A pointer to a string that specifies the file name the current log file should be renamed to. If this parameter is NULL or an empty string, the current log file will be deleted.

Return Value

If the method succeeds, the return value is non-zero. If logging is not currently enabled for the server, this method will return zero.

Remarks

The RenameServerLogFile method is used to rename or delete the current log file. Note that this does not change the current log file name or disable logging by the server. It only changes the file name of the current log file, or removes the log file if the lpszFileName parameter is NULL. This can be useful if you want your server to perform log file rotation, archiving the current log file. By renaming the current log file, the server will automatically create a new log file with original file name.

This method must be used to rename or delete the current log file while logging is active because the server holds an open handle on the file. The application should not use the GetLogFile method to obtain the log file name and then use the MoveFileEx or DeleteFile Windows API functions with that file.

To disable logging, use the SetLogFile method and specify the logging format as FTP_LOGFILE_NONE.

Requirements

Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: csftsv10.lib
Unicode: Implemented as Unicode and ANSI versions.

See Also

GetLogFile, SetLogFile