如何修改 net.schmizz.sshj 日志记录级别?
how can I modify net.schmizz.sshj logging level?
到目前为止我的代码可以更改默认配置的记录器级别或禁用它吗 [
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>
顺便说一句,您看到这些消息的原因是您 运行 没有无限强度的加密扩展。
到目前为止我的代码可以更改默认配置的记录器级别或禁用它吗 [
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>
顺便说一句,您看到这些消息的原因是您 运行 没有无限强度的加密扩展。