- https://logging.apache.org/log4j/2.x/performance.html
Maven 依赖
org.springframework.boot spring-boot-starter-weborg.springframework.boot spring-boot-starter-loggingorg.springframework.boot spring-boot-starter-log4j2com.lmax disruptor3.3.6
XML 配置 resources/log4j2.xml
- 混合 sync/async
- 彩色日志
- 分类输出到不同文件
- 自动压缩日志文件并归档
/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{[%15.15t]}{faint} %clr{%-40.40c{1.}}{cyan} %clr{:}{faint} %m%n%xwEx
最终效果如下:
© 著作权归作者所有,转载或内容合作请联系作者
问题来了,请问诸位你们项目中目前在使用Logback还是Log4j2呢?
● 【双11狂欢的背后】微服务注册中心如何承载大型系统的千万级访问?
● Spring Boot 新一代监控你该这么玩
● Spring Boot 异常处理
● Spring Boot 配置 - 配置信息加密
● 拒绝黑盒应用-Spring Boot 应用可视化监控
● 并发Bug之源有三,请睁大眼睛看清它们
本文由博客一文多发平台 OpenWrite 发布!



