SLF4J appears to support TRACE
, DEBUG
, INFO
, WARN
and ERROR
levels out of the box.
Is there a way to add my own custom levels?
Developers just need to include the logging framework dependency in the classpath and SLF4J will utilize it to append the logs. If no logging dependency is provided on the classpath, it will default to a no-operation implementation and nothing gets logged.
This is the main purpose of SLF4J (Simple Logging Facade for Java) – a logging abstraction which helps to decouple your application from the underlying logger by allowing it to be plugged in – at runtime. Of course, the flexibility that such an abstraction provides is the main reason to use SLF4J.
Thus, if your SLF4J provider/binding is slf4j-log4j12. jar, you are safe regarding CVE-2021-44228. If you are using log4j-over-slf4j. jar in conjunction with the SLF4J API, you are safe unless the underlying implementation is log4j 2.
The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logging frameworks (e.g. java. util. logging, logback, log4j) allowing the end user to plug in the desired logging framework at deployment time.
The levels supported by SLF4J are fixed and cannot be changed. However, SLF4J supports markers allowing infinite flexibility in tagging/categorizing log messages. All printing method in the Logger interface have a variant which takes a Marker as its first argument.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With