我可以更改默认配置的记录器级别,或者为sshj库禁用它我的代码到目前为止[
Config config = new DefaultConfig();
config.setKeepAliveProvider(KeepAliveProvider.KEEP_ALIVE);
SSHClient sshClient = new SSHClient(config);
当我尝试上面的代码时,我遇到了这些问题:
[main] WARN net.schmizz.sshj.DefaultConfig - Illegal key size
[main] WARN net.schmizz.sshj.DefaultConfig - Illegal key size
[main] WARN net.schmizz.sshj.DefaultConfig - Illegal key size
[main] WARN net.schmizz.sshj.DefaultConfig - Illegal key size
[main] WARN net.schmizz.sshj.DefaultConfig - Illegal key size
[main] WARN net.schmizz.sshj.DefaultConfig - No such algorithm: IDEA/CBC/NoPadding
[main] WARN net.schmizz.sshj.DefaultConfig - No such algorithm: IDEA/CTR/NoPadding
[main] WARN net.schmizz.sshj.DefaultConfig - Illegal key size
[main] WARN net.schmizz.sshj.DefaultConfig - Illegal key size
[main] WARN net.schmizz.sshj.DefaultConfig - Illegal key size
[main] WARN net.schmizz.sshj.DefaultConfig - Illegal key size
[main] WARN net.schmizz.sshj.DefaultConfig - Illegal key size
[main] WARN net.schmizz.sshj.DefaultConfig - Illegal key size
[main] WARN net.schmizz.sshj.DefaultConfig - Illegal key size
[main] WARN net.schmizz.sshj.DefaultConfig - Illegal key size
[main] WARN net.schmizz.sshj.DefaultConfig - Illegal key size
[main] WARN net.schmizz.sshj.DefaultConfig - Illegal key size or default parameters
[main] WARN net.schmizz.sshj.DefaultConfig - Disabling high-strength ciphers: cipher strengths apparently limited by JCE policy
答案 0 :(得分:1)
SSHJ使用slf4j日志记录API。这意味着您可以使用任何实现slf4j的日志记录实现来配置它。通常这是logback记录器。
您可以通过添加包含例如以下配置的logback.xml文件来配置它:
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%.-20thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT"/>
</root>
<logger name="net.schmizz.sshj" level="error"/>
</configuration>
BTW你看到这些消息的原因是你在没有无限强度加密扩展的情况下运行。