Home Forums .NET libraries Xceed SFTP/FTP for .NET More verbose logging

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #21387 |

    Is there a way to get more verbose logging out of the FtpClient or FtpConnection objects? I’m setting the TraceWriter property, but was wondering if there’s another setting to get more information.

     Thanks

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by ganders (had 722 views)

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi ganders,

    When you get an exception, you can “drill down” the inner exceptions to get more information about the exception.

    Each System.Exception object contains a InnerException property. You can loop on each inner exception, taking note of each exception along the way until InnerException is null.

    Example in C#:

      try
      {
        // TODO: Code that causes an exception
      }
      catch( Exception exception )
      {
        // Output some information about it
        Console.WriteLine( “–>{0}: {1}\n{2}”, exception.GetType().Name, exception.Message, exception.StackTrace );

        // Fetch the inner exception
        exception = exception.InnerException;

        // While there is an exception
        while( exception != null )
        {
          // Output some information about it
          Console.WriteLine( “–>Inner exception: {0}: {1}\n{2}”, exception.GetType().Name, exception.Message, exception.StackTrace );

          // Fetch the inner exception
          exception = exception.InnerException;
        }
      }

    Example in VB.NET:

      Try
        ‘ TODO: Code that causes an exception
      Catch exception As Exception
        ‘ Output some information about it
        Console.WriteLine(“–>{0}: {1}” & Constants.vbLf & “{2}”, exception.GetType().Name, exception.Message, exception.StackTrace)

        ‘ Fetch the inner exception
        exception = exception.InnerException

        ‘ While there is an exception
        Do While exception IsNot Nothing
          ‘ Output some information about it
          Console.WriteLine(“–>Inner exception: {0}: {1}” & Constants.vbLf & “{2}”, exception.GetType().Name, exception.Message, exception.StackTrace)

          ‘ Fetch the inner exception
          exception = exception.InnerException
        Loop
      End Try

     

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Diane [Xceed] (had 160 views)

    User (Old forums)
    Member
    Post count: 23064

    Actually, I’m looking for more logging information in the Xceed.Ftp.FtpConnection.TraceWriter property….not exceptions.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by ganders (had 694 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.