mwiede / jsch

fork of the popular jsch library
Other
763 stars 144 forks source link

How to enable all level log including Debug level #685

Open je-ck opened 1 month ago

je-ck commented 1 month ago

I try the following code to log out detail client procedure, but only get info level logging. how can I setup debug level ?

import com.jcraft.jsch.Logger;
import com.jcraft.jsch.JSch;
public class MyLogger implements Logger {
    public boolean isEnabled(int level) {
        return true;
    }

    public void log(int level, String message) {
        System.out.println(message);
    }
}

public class Main {
    public static void main(String[] args) {
        JSch jsch = new JSch();
        jsch.setLogger(new MyLogger());
        System.setProperty("com.jcraft.jsch.logger", "DEBUG");
       //all other code...
    }
}

Remote version string: SSH-2.0-OpenSSH_8.9p1 Ubuntu-3 Local version string: SSH-2.0-JSCH-0.1.54