edtFTPnet/Free - Open-source FTP component for .NET | Download
 How to set up logging

Often, it can be very helpful to look at the extensive logging output if any problems are experienced communicating with FTP servers.

All commands sent to the FTP server and subsequent replies are logged, and can be made available on the console or directed to a log file. Much other useful information is also logged.

Statements are logged at different levels, ranging from least verbose (Fatal) to most verbose (Debug). Intermediate levels are Error, Warning and Information. An overall level can be set for the library, and all statements up to and including that level will be outputted.

For example, if the overall level is set to Information, then Fatal, Error, Warning and Information log statements will be outputted, but Debug statements will not be.

There are also two additional levels that can be conveniently used - None, which means no logging will occur, and All, which means all log statements will be outputted, no matter what level they are. The All level is actually an additional level which is used for extremely verbose output - so when the level is set to All more log statements may be outputted than at Debug.

The overall level can be set via the static LogLevel property:

FTPConnection.LogLevel = LogLevel.Information;

The destination for logging can be set via several properties, described below.

LogToConsole
If set to true, logging is directed to the console
LogFile
If to a valid filename, logging is directed to the file