how to use slf4j in java agent when in spring boot - java

Springboot uses JarLauncher so that a nested jar is supported.
But the agent code do not load class by using JarLauncher because it executes before the main method.As a result, the console will print
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
--update
This issue can reproduce the problem.
https://github.com/libinglong/skywalking-threadpool-agent/issues/2

Related

How to disable slf4j in jetty

I am using a self code logger and i dont want implement to slf4j.
And Jetty will prints:
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.
How to disable this stupid output?
Im not using Spring or something like that. I just import jetty library and it prints...
Use a slf4j-nop logger
Add this in dependencies block of build.gradle
kotlin DSL:
implementation("org.slf4j:slf4j-nop:2.0.0-alpha1")

SoapUI SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”

How to resolve the problem of 'SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”' when running SoapUI (mine is 5.2.1) command-line testrunner.bat?
NOTE: This problem had been answered in a number of places for Maven, Eclipse, etc. but not for SoapUI. E.g.:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". in a Maven Project
The problem, as explained in http://www.slf4j.org/codes.html is that one (and only one) of the following is missing in the classpath: slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar.
I found that adding, e.g. slf4j-simple.jar to [SoapUI-Base]/bin/ext did not work, even though it apparently loaded it:
13:02:26,203 INFO [SoapUI] Adding [C:\Program Files\SmartBear\SoapUI-5.2.1\bin\ext\slf4j-simple-1.6.1.jar] to extensions classpath
13:02:26,983 INFO [DefaultSoapUICore] initialized soapui-settings from [C:\Users\XXX\soapui-settings.xml]
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
What worked was to place slf4j-simple.jar, and more specifically, slf4j-simple-1.6.1.jar (to be compatible with the SLF4J version used in SoapUI 5.2.1) into [SoapUI-Base]/lib.
Hope this helps.
this is solution that help me.
I have downloaded last slf4j package from http://www.slf4j.org/download.html
Delete from SmartBear\SoapUI-5.2.1\lib file slf4j-api
Insert to the SmartBear\SoapUI-5.2.1\lib files from package slf4j-api and slf4j-nop
Now everything works fine.

Failed to load class org.slf4j.impl.StaticLoggerBinder and Unable to load native-hadoop library

I'm new with Hadoop and during one MapReduce task I got the following error:
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.
15/09/18 07:31:10 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
How can I solve this?
Thanks!
Here's what your errors mean:
For SLF4J:
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.
As you can tell, you do not have the appropriate class (*Failed to load class*) for SLF4J to work so it defaults to no logging ((NOP) logger implementation). Following the suggested link you can see that the solution for this is:
Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem
For Hadoop:
15/09/18 07:31:10 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
This just means that the native library cannot be found, it generally doesn't affect the way Hadoop functions. As for the native library:
The native library just contains implementations of certain components for performance reasons and for non-availability of Java implementations. These components are available in a single, dynamically-linked native library called the native hadoop library. On the *nix platforms the library is named libhadoop.so.
Anyway, if you really want to get rid of the warning, you can follow one of the many solutions offered here.

The Java Wiki Bot Framework logging

I am using The Java Wiki Bot Framework to do changes in a mediawiki website using java, and it works fine. The only problem is that the JWBF produces a a huge volume of debugging information in the console of my application that is overshadowing my output and make it hard to find, visually. is their anyway that I could stop the logging for JWBF? BTW, JWBF uses SL4J for logging.
This is a slf4j related topic. If no logger binding is defined, you see the following
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.
If you add a binding e.g. Logback, you can reduce logging output. Your logback.xml should contains a line like
...
<logger name="net.sourceforge.jwbf" level="ERROR"/>
...
For more details see Logback configuration

Xuggler generates error message

I was working on creating my first Xuggler media application. I was coding by watching their video on how to create the first media application.
Code
package demo;
import com.xuggle.xuggler.IContainer;
public class GetContainerInfo {
public static void main(String[] args) {
if(args.length!=1){
throw new IllegalArgumentException("no file");
}
IContainer container = IContainer.make();
if(container.open(args[0],IContainer.Type.READ,null)<0){
throw new IllegalArgumentException("could not open");
}
}
}
Error
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.
Do I have the dependencies?
Yes, I do! I have all the dependencies. I imported them while creating the project.
Image:
What is causing that error and how do I solve it?
From SLF4J manual:
> 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.
This warning is printed because no slf4j binding could be found on
your class path. The warning will disappear as soon as you add a
binding to your class path. Assuming you add slf4j-simple-1.7.2.jar so
that your class path contains: slf4j-api-1.7.2.jar
slf4j-simple-1.7.2.jar ...
Cause Could be un-availability of dependency jars or version conflicts.
Adding the following jars in the class path worked fine for me:
xuggle-xuggler-5.4.jar
slf4j-api-1.6.4.jar
logback-core-1.0.0.jar
logback-classic-1.0.0.jar

Categories