Questions tagged [slf4j-api]
53 questions
19
votes
4 answers
Class path contains multiple SLF4J bindings error
I get this error when tring to run gradle build
i understand it a versions conflict but not sure how to solve it and which
version to exclude...
gradle dependency tree is:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in…

roman
- 607
- 2
- 10
- 18
13
votes
4 answers
Difference between slf4j-log4j12 vs log4j
In a project's pom.xml I am seeing a dependency like below
org.slf4j
slf4j-api
1.7.5
…

tuk
- 5,941
- 14
- 79
- 162
8
votes
5 answers
Convenient Kotlin LoggerFactory simplification
What is the most convenient way to use SLF4J or other logging approaches with kotlin?
Usually the developer is busy with boilerplate code like
private val logger: Logger = LoggerFactory.getLogger(this::class.java)
in each and every class to get a…

Martin Mlostek
- 2,755
- 1
- 28
- 57
5
votes
3 answers
How do you format an exception in slf4j?
From many examples I found online , the documentation and here in Stack overflow , the right way to concatenate strings in slf4j is to use the built-in string formatting.
For example :
LOGGER.error("ExceptionHandler throws {}" ,…

Yeikel
- 854
- 10
- 18
4
votes
1 answer
Configure logging for Apache Beam and Kafka Client with SLF4j
I use Apache Beam vs Kafka Clients to process my data but the library Kafka Clients produces a lot of message so they do really mess in stack trace, how can I change log level for this package?
Versions of dependecies: slf4jVersion=1.7.29,…

boden
- 1,621
- 1
- 21
- 42
4
votes
1 answer
Connect commons-logging to slf4j-api
Wanted to know the dependency that i should include to bridge commons-logging to slf4j-api.
My build is successful by adding…

Curious89
- 63
- 1
- 6
4
votes
1 answer
How to display the identity hash code of an instance in logback's encoder pattern?
The encoder pattern in logback.xml like
%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
allows to…

Kalle Richter
- 8,008
- 26
- 77
- 177
4
votes
3 answers
Error java.lang.ClassNotFoundException: org.slf4j.LoggerFactory when trying to execute the jar
When I try to do java -jar app.jar I get this:
Exception in thread "JavaFX Application Thread" Exception in thread "main"
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at tao.qaflash.GUI.(GUI.java:14)
at…

Adriana Frunza
- 53
- 1
- 1
- 5
3
votes
2 answers
Version Sanity Check (Spring/SLF4J)
I am trying to deploy Spring Boot application on Tomcat. But somehow I am getting:
Unexpected problem occured during version sanity check
Reported exception:
java.lang.AbstractMethodError:…

hell_storm2004
- 1,401
- 2
- 33
- 66
3
votes
4 answers
Simplify lazy logging with SLF4J
I am using SLF4J with Logback in a Spring Boot application. I was interested in using lazy logging and after some research, I came up with this solution.
This works as expected and does not invoke methods if the logging level is not…

Didula Egodage
- 43
- 6
3
votes
0 answers
Warnings count in slf4j?
Is there an easy way to find out programmatically the total number of messages that have been logged at a certain level since the program started? I could do that by writing a wrapper around a Logger and using it everywhere, but perhaps there is an…

biggvsdiccvs
- 299
- 3
- 12
2
votes
1 answer
Spring boot + slf4j + log4j + class org.apache.logging.slf4j.SLF4JLoggerContext cannot be cast to class
I have Spring boot 2.3.1
pom.xml

skyho
- 1,438
- 2
- 20
- 47
2
votes
1 answer
Velocity upgrade from 1.7 to 2.0
I am trying to migrate from velocity 1.7 where I use LogChute interface. In my current implementation I have used the log method to get the velocity log level and comparing our own log level. Please see the code below.
@Override
public void log(int…

TechEnthusiastic
- 23
- 6
2
votes
1 answer
How to replace MarkerIgnoringBase in SLF4J
There is some old code that we have in our code base which extended MarkerIgnoringBase. Since we are in the process of migrating, I added the dependency in maven of 2.0.0-alpha1.
But the class MarkerIgnoringBase, I see has been deprecated. Just…

hell_storm2004
- 1,401
- 2
- 33
- 66
2
votes
3 answers
java.lang.NoClassDefFoundError: Lorg/slf4j/Logger
I am launching tomcat using Intellij with maven support. Once I add the following tomcat maven dependency:
…

chrisTina
- 2,298
- 9
- 40
- 74