Java log framework selection and use

Java log framework selection and use

1. What we often hear is the following day framework. I don’t know how to choose it? Let me teach you how to choose
①: JUL (java.util.logging)
②: JCL (Jakarta Commons-Logging) by apache company Jakarta Developed by the team,
③:JBoss-logging
④:logback
⑤:log4j
⑥:log4j2
⑦:slf4j (Simple Logging Facade for Java.)

Insert picture description here
At the bottom of Spring, we chose our JCL as the log facade.
SpringBoot chose SLF4J as our log facade (log4j, and logback at the time). He chose logback. The
following figure shows the matching method when we choose the log.
Insert picture description here
2. Source code analysis
The logging technology used at the bottom of Spring 4.Xspring
Insert picture description here
We can see from here that among the log objects obtained by spring4.x, the LOGGer object is jCL, and the technical point of his bottom collocation is
to find the log implementation of log4j first. If you do not find the bottom layer, go to the log framework of jdk. Does not support logback, log4j2 log technology.

The logging technology used at the bottom of Spring 5.x
Insert picture description here
3. End, study this blog carefully, I believe that the log will become very simple for you.

Guess you like

Origin blog.csdn.net/mlplds/article/details/103434721