Can't get SLF4J logging to work
See original GitHub issueI am trying to get slf4j to work within the notebooks because some 3rd party libs that I use need it. When I try to set jshell classpath directly through --class-path
it works. If I set IJAVA_CLASSPATH
in kernel.json to point to the logging jars or when I import them in the notebook, it does not work, it says SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
%maven org.slf4j:slf4j-api:1.7.16
%maven ch.qos.logback:logback-classic:1.0.13
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.impl.StaticLoggerBinder;
Logger slf4jLogger = LoggerFactory.getLogger("T");
slf4jLogger.warn("Hi, {}", "Test");
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How slf4j works? No log getting created - Stack Overflow
SLF4J is just a logging abstraction - it doesn't write any logs itself. Use Logback - it implements SLF4J natively and is written...
Read more >SLF4J FAQ
SLF4J is a simple facade for logging systems allowing the end-user to plug in the desired logging system at deployment time. When should...
Read more >I cannot get my slf4j logging statements to print to standard ...
I cannot get my slf4j logging statements to print to standard output or a file. I have the following slf4j logging code: import...
Read more >Introduction to SLF4J - Baeldung
A quick and to the point guide of how to use Log4j2 and Logback with ... There are cases when we cannot replace...
Read more >SLF4J Tutorial: Configuration Example for Logging in Java
When using SLF4J you probably won't be using the slf4j-simple library and you'll want to use it with a dedicated logging framework so...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for the report. I was able to reproduce and can confirm this is a bug.
Classpath related things are an ongoing issue with all the dynamic loading going on in this environment. I’ve been trying to find a fix but the closest I’ve gotten in with the newest beta version and manually loading things which still has some warnings but eventually does log something. I will continue to investigate and update when I get a chance.
In case you are curious this is what I am referring to is the following which essentially pulls out the code from slf4j that loads the logger.
Thank you a million 😃 It works as needed so far.