Logging with FtpLogStream (Branch: System.Net.FtpClient_1)

Oct 7, 2012 at 10:10 AM
Edited Oct 7, 2012 at 10:10 AM

Good morning,

i would like logging in a file. I find in your example this samplecode:

 using (FtpClient cl = new FtpClient("ftp", "ftp", "ftp.netbsd.org")) 
  {

                cl.FtpLogStream = Console.OpenStandardOutput();
          
                ...
  }

I use your library in a Windows.Forms project. My problen is now to get the
FtpLogStream. When i try
private void Test()
{
     Stream _LogStream;

     _LogStream = fptClient.FtpLogStream 
}
i get null! How can i get the stream?

with greetings
Coordinator
Oct 7, 2012 at 12:17 PM


FtpLogStream should be set to a stream that you want to log to. Here’s an
example of logging to a file:

cl.FtpLogStream = new FileStream(”ftp_log.txt”, ....);

Console.OpenStandardOutput() opens a stream to the console window’s STDOUT.

Thanks,
J.P.

Oct 8, 2012 at 7:01 AM

Good morging.

i´ve created a simple testproject to test your samplecode. The logging works fine. But one thing doesn´t work. When i use the methode ftpClient.Disconnect(), the program stops by the ftpClient.Disconnect methode. Can you confirm the same problem?

 

with greetings

Coordinator
Oct 8, 2012 at 1:44 PM

Sorry, I can't confirm there is a problem. Connecting and disconnecting seem to work fine. I need to see code, a transaction log, and the server software in order to take this any further.