If you are looking for software to use, go to Huajun Software Park! software release AI product list

Hello, if there is a need for software inclusion, please package the software and attach the software name, software introduction, software-related screenshots, software icon, soft copy, business license (if you do not have a business license, please provide the front and back of the corresponding developer ID card and a photo of yourself holding the ID card), and send it to email http://softwaredownload4.com/sbdm/user/login

Close >>

Send to email:news@onlinedown.net

Close >>

SLF4J

SLF4J 1.5.6 official version

QR code
  • Software licensing: free software
  • Software size: 2.24MB
  • Software rating:
  • Software type: foreign software
  • Update time: 2024-12-23
  • Application platform: Linux/FreeBSD/UNIX
  • Software language: English
  • Edition: 1.5.6 Official version

Download the service agreement at the bottom of the page

Software introduction Related topics FAQ Download address

Recommended for you:- SLF4J

Basic introduction
SLF4J segment first LOGO
SLF4J official version is a professional programming development tool. The full name of the latest version of SLF4J is Simple Logging Facade for Java can be used as a simple facade or abstraction to serve various logging frameworks such as java.util.logging and logback. The SLF4J tool can help end users integrate the logging framework they want during deployment, which is safe and powerful.

SLF4J screenshot

SLF4J software introduction

slf4j, simple logging facade for Abbreviation for java, translated as java's simple log appearance. slf4j is an open source project that provides us with a consistent API to use different logging frameworks, such as: java.util.logging, logback, log4j, etc. slf4j enables users to embed the logging framework they want to use at runtime. As can be seen from the name, it is actually implemented using the facade design pattern.

When using slf4j, there is only one mandatory dependency, which is slf4j-api-x.x.x.jar. When we write code, we will only use the API in this jar package. The application will search the specific log framework bound in the class path at runtime, and use the bound log framework to perform actual log operations. If no suitable binding is found under the application's class path, slf4j will use an implementation without any operation by default.

​​ slf4j is used in many famous projects, such as: Apache ActiveMQ, Ehcache, H2 database, Gradle, GreenMail, Hibernate.....

SLF4J software features

   Binary compatible

An SLF4J binding specifies a specific dependency used to bind slf4j in the underlying logging framework, such as slf4j-jdk14.jar or slf4j-log4j12.jar.

​​​​ Mixing different versions of slf4j-api.jar and SLF4J bindings may cause problems. For example, if you use slf4j-api-1.7.19.jar, then you should use slf4j-simple-1.7.19.jar, use slf4j-simple-1.5.5.jar will not work properly.

​ ​ However, from a client perspective, all versions of slf4j-api are compatible. The client code compiled using slf4j-api-N.jar will be the same as slf4j-api-M.jar works perfectly together, N and M are both arbitrary. You just need to make sure that the version you bind matches slf4j-api.jar. You don’t need to worry about the dependencies given in your project Lai's version of slf4j-api.jar. You can use any version of slf4j-api.jar as long as As long as the version of slf4j-api.jar matches its binding, there will be no problem.

At initialization time, if SLF4J suspects there may be a mismatch problem. A warning message will be issued about the mismatch.

   Unified logs through SLF4J

Often, a given project depends on a variety of components that rely on logging APIs other than SLF4J. It is common for a project to depend on a JCL, java.util.logging, log4j and SLF4J. Then it becomes satisfying to unify the logs in a single way. SLF4J provides support for JCL,

​ ​​ java.util.logging, and the slf4j bridging module to meet this common use case. For more details, please refer to Bridging legacy APIs.

      MDC support

“Mapped Diagnostic "Context" is essentially a map included in the logging framework. The application code provides a key-value pair. This key-value pair can be inserted into the log information by the logging framework. MDC data is very useful when filtering information or triggering certain actions.

SLF4J supports MDC. If an underlying logging framework provides MDC functionality, SLF4J will delegate to the MDC of the underlying logging framework. Note that currently only log4j and logback provide MDC functionality. If the underlying logging framework does not support MDC, such as java.util.loggin, SLF4J will store the MDC number However, the data inside needs to be obtained by the user through code.

Therefore, as an SLF4J user, you can take advantage of MDC information when log4j and logback exist, but you cannot force the user to rely on these logging frameworks.

SLF4J usage instructions

​ ​ 1. If you use maven and add slf4j-api dependency, we use the latest version 2.0.0-alpha1; then add an implementation framework logback, logback-classic implements the slf4j interface, we also add the latest version 1.3.0-alpha5.

SLF4J screenshot

​ ​ 2. Add the logback.xml configuration file

SLF4J screenshot

3. Write a test program

SLF4J screenshot

SLF4J update log

​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

Optimize user feedback issues and improve detailed experience

Huajun editor recommends:

SLF4J software takes up little memory, has stable performance, is free of any bundles, is green and safe, and is truly a conscientious software! This site also hasMaven,OpenCart,Java2 Runtime Environment,Eclipse IDE for Java EE Developers For Linux(64-bit),Free Pascal, available for you to download!

FAQ