DataFlex
DataFlex
Clear the FTP Session Log
See more FTP Examples
Demonstrates the Chilkat Ftp2.ClearSessionLog method, which clears the in-memory FTP protocol log collected while KeepSessionLog is enabled. It takes no arguments.
Background: With session logging on, the
SessionLog accumulates the full FTP command/reply conversation, which is invaluable for diagnosing a failed transfer. Over a long-lived session it grows unbounded, so clearing it frees memory — and, more usefully, lets you capture the log for one specific operation in isolation by clearing just before and reading just after.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoFtp
String sTemp1
Move False To iSuccess
// Demonstrates the Ftp2.ClearSessionLog method, which clears the in-memory FTP protocol log. It
// takes no arguments and is a void method.
Get Create (RefClass(cComChilkatFtp2)) To hoFtp
If (Not(IsComObjectCreated(hoFtp))) Begin
Send CreateComObject of hoFtp
End
Set ComHostname Of hoFtp To "ftp.example.com"
Set ComUsername Of hoFtp To "myFtpLogin"
// Normally you would not hard-code the password in source. You should instead obtain it
// from an interactive prompt, environment variable, or a secrets vault.
Set ComPassword Of hoFtp To "myPassword"
Get ComConnect Of hoFtp To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoFtp To sTemp1
Showln sTemp1
Procedure_Return
End
// The SessionLog accumulates the FTP protocol conversation when KeepSessionLog is enabled, which
// is useful for debugging.
Set ComKeepSessionLog Of hoFtp To True
// ... perform some operations ...
// Clear the log, for example before starting a new logical operation whose log you want to
// capture in isolation.
Send ComClearSessionLog To hoFtp
Showln "Session log cleared."
Get ComDisconnect Of hoFtp To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoFtp To sTemp1
Showln sTemp1
Procedure_Return
End
End_Procedure