How to deal with logs in Spring Boot
This article mainly explains the "Spring Boot how to log processing", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Spring Boot how to log processing" bar!
▶ Log4j2 performance
Https://logging.apache.org/log4j/2.x/performance.html
▶ Spring Boot dependency and configuration
Maven dependence
Org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-logging org.springframework.boot spring-boot-starter-log4j2 Com.lmax disruptor 3.3.6
XML configuration resources/log4j2.xml
Hybrid sync/async
Color log
Classify and export to different files
Automatically compress log files and archive
/ Users/admin/Code/log/ Users/admin/Code/log/7z?% clr {% d {yyyy-MM-dd HH:mm:ss.SSS}} {faint}% clr {% 5p}% clr {${sys:PID}} {magenta}% clr {- -} {faint}% clr {[.15t]} {faint}% clr {%-40.40c {1.} {cyan}% Clr {:} {faint}% m%n%xwEx
The final effect is as follows:
The question is, are you currently using Logback or Log4j2 in your project?
Thank you for your reading, the above is the content of "how to deal with the log of Spring Boot". After the study of this article, I believe you have a deeper understanding of how to deal with the log of Spring Boot, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!