edtFTPnet/PRO - Secure FTP component for .NET | Free Trial | Pricing

How to set up logging

Often, it can be very helpful to look at edtFTPnet/PRO's 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 within edtFTPnet/PRO 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:

SecureFTPConnection.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

LogToTrace

If set to true, logging is directed to .NET's Trace facility

LogFile

If to a valid filename, logging is directed to the file

An application configuration setting, edtftp.log.level, can also be used to set the logging level from the configuration file (in the appSettings section).

For example, the following configuration could be used to set the global logging level to Information and the log file destination:


	<configuration>
		<appSettings>
			<add key="edtftp.log.level" value="Information"/>
			<add key="edtftp.log.file" value="D:\logs\application.log"/>
		</appSettings>
	</configuration>
	

This application setting will be overridden by explicitly using the LogLevel property.