I have a program that alternates between FTP and SFTP usage in order to perform some operations on a remote server.
For the FTP part, I am using the Apache Commons FTP client, whereas for the SFTP I am using the JSch library.
Apache commons, can and will, print out fully verbose all the commands issued by the client to the server, in addition with the server's response.
I would like to do something similar with JSch in order for me to be consistent in how my application logs in both cases.
I have tried implementing the Logger interface of the JSch library successfully, but it turns out that it cannot provide me with a verbose representation of the commands issued to the server, as well as it's response.
I have tried looking for similar solutions but they all revolve around doing something similar to I what I am looking for an SSH session and not for a SFTP session.
I have tried creating a PrintStream and then setting it as the OutputStream of the channel but this hasn't worked.
I have also tried implementing some suggestions I have found here that revolve around having a thread that will capture the channel's InputStream and OutputStreams but so far I have not been able to get something to work correctly.
My question is, has anyone managed to do something like that - e.g. printing out the underlying FTP dialog - while using the JSch library?