Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I modify net.schmizz.sshj logging level?

Can I change the level of logger for the default config or disable it for sshj library my code so far [

Config config = new DefaultConfig();
config.setKeepAliveProvider(KeepAliveProvider.KEEP_ALIVE);
SSHClient sshClient = new SSHClient(config);

and when I try the above code I have these problems :

[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
like image 716
AhMaD AbUIeSa Avatar asked Oct 29 '22 09:10

AhMaD AbUIeSa


1 Answers

SSHJ uses the slf4j logging API. This means that you can configure it with any logging implementation that implements slf4j. Typically this is the logback logger.

You can configure that by adding a logback.xml file containing for instance the following configuration:

<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 the reason you're seeing those messages is that you're running without the unlimited strength cryptography extensions.

like image 70
Hiery Nomus Avatar answered Nov 16 '22 14:11

Hiery Nomus