-
-
Notifications
You must be signed in to change notification settings - Fork 656
Logging
- client.Logger - A custom
IFtpLogger
instance, which can be used withFluentFTP.Logging
to connect to the industry-standardILogger
instance that can in turn integrate with any .NET logging framework. See the diagram below for a visual explanation. See this issue for the full design discussion.
-
client.LegacyLogger - A property of
FtpClient
. Assign this to a callback that will be fired every time a message is logged. -
client.Config.LogToConsole - Should FTP communication be be logged to the console? Default: false.
-
client.Config.LogHost - Include server IP addresses in logs? Default: false.
- Example log message if this is
true
:Status: Connecting to 123.123.123.123:21
- Example log message if this is
false
:Status: Connecting to ***.***.***.***:21
- Example log message if this is
-
client.Config.LogUserName - Include FTP usernames in logs? Default: false.
- Example log message if this is
true
:Response: 331 Password required for jason_admin
- Example log message if this is
false
:Response: 331 Password required for ***
- Example log message if this is
-
client.Config.LogPassword - Include FTP passwords in logs? Default: false.
- Example log message if this is
true
:Command: PASS supersecretST@nKS
- Example log message if this is
false
:Command: PASS ***
- Example log message if this is
-
client.Config.LogDurations - Include FTP command roundtrip duration in the logs? Default: true.
- Example log message if this is
true
:Response: 150 File not found [5 sec]
- Example log message if this is
false
:Response: 150 File not found
- Example log message if this is
You can use any logging framework that creates a MELA ILogger instance, such as:
You can even use other frameworks not listed here, but then you will have to write a small wrapper function yourself.
Do this after creating your FtpClient:
client.Config.LogToConsole = true;
Alternatively:
- You can hook onto
client.LegacyLogger
to get a callback every time a message is logged in the context of an individualFtpClient
instance. - You can set any ILogger compatible logger into
client.Logger
You can use any logging provided to help you log to a file. You then have to set this ILogger instance provided by your logging framework into our FTP Client's Logger
property.
- Example code:
- Nuget packages required:
- Example code:
- Nuget packages required:
Use these settings to control what data is included in the logs:
- client.Config.LogUserName - Log FTP user names?
- client.Config.LogPassword - Log FTP passwords?
- client.Config.LogHost - Log FTP server host/IP addresses?
- Auto Connection
- Auto Reconnection
- FTP(S) Connection
- FTP(S) Connection using GnuTLS
- FTPS Proxies
- Custom Servers
- Custom Commands
- v40 Migration Guide