I just wanted to add a small comment to the accepted answer, but the reputation does not allow. Sorry if this path through another answer is evil, but really want to mention the following.
Activating the log works this way, and you can get a lot of information about the connection process (key exchange, etc.). But after authentication, there is practically no such thing as debug output for basic functionality, at least for SFTP. And look at the source showing / confirming that there is no registration in ChannelSftp (and other classes).
So, if you want to activate this in order to check communication problems (after authentication) that were wasted, or you need to add the appropriate statements to the source yourself (I have not done this yet).
We are faced with complete freezes (worker threads get stuck for days / endlessly) in put, get and even ls - and, of course, the server provider claims that this is not a problem (and the unix sftp commandline-client really works, but not from the host appserver, to which we do not have access ... so we will need to check the network communication). If anyone has an idea, thanks ..
source share