gpt4 book ai didi

java - 如何修改 net.schmizz.sshj 日志级别?

转载 作者:搜寻专家 更新时间:2023-11-01 03:32:55 35 4
gpt4 key购买 nike

到目前为止,我可以更改默认配置的记录器级别或为 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

最佳答案

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>

顺便说一句,您看到这些消息的原因是您在没有无限强度加密扩展的情况下运行。

关于java - 如何修改 net.schmizz.sshj 日志级别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43346755/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com