[JAVA] Suppress warning messages about SLF4J when using SSHJ

Thing you want to do

This is to suppress the warning message that is output when using SSHJ.

Problem summary

A warning message is output when the SSHClient class of SSHJ is new.

Problem details

The following warning message is output when the SSHClient class of SSHJ is new.

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Even if a warning is output, SSHJ can be used without any problem. Maybe it's just that you can't output logs.

solution

First of all, simply refer to the site indicated in the warning message. Then

-The message is output when the "org.slf4j.impl.StaticLoggerBinder" class cannot be loaded into memory. --The problem is solved by placing one of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar, or logback-classic.jar in the classpath. thing

Is written. So, I was able to suppress the warning message by placing slf4j-nop-x.x.x.jar in the classpath of the execution environment. The x.x.x part is the version number.

By the way, if you want to compile / debug Eclipse Maven project, you should write the following in pom.xml.

pom.xml


<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-nop -->
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-nop</artifactId>
    <version>1.7.7</version>
</dependency>

In the above example, 1.7.7 is specified for the version because SSHJ seems to need 1.7.7 of slf4j-api, so let's match it with that version. It was.

-- that's all--

Recommended Posts

Suppress warning messages about SLF4J when using SSHJ
Error handling when Gradle dependency is using SLF4J
About class upgrade when using Spark Streaming on YARN