log4j-over-slf4j
时间: 2023-09-19 16:06:04 浏览: 127
log4j-over-slf4j是一个用于将log4j日志框架转换为SLF4J日志框架的桥接器。它的作用是将log4j接口输出的日志通过log4j-over-slf4j路由到SLF4J上,从而实现日志的集中输出。\[1\]在java的日志框架结构中,slf4j和jcl作为日志的门面存在于最上层,而log4j、jul、logback等则是这些门面的不同实现。为了使log4j也能符合slf4j规范,就出现了slf4j-log4j12这个桥接器,它的作用是将log4j适配为slf4j的接口实现。\[2\]而log4j-over-slf4j的作用则是将引入的jar包中的log4j替换为log4j-over-slf4j,从而统一项目中的日志框架,避免冗余和复杂性。具体来说,log4j-over-slf4j会将使用log4j打印日志的地方转换为slf4j打印日志,而slf4j实际调用的是logback来具体实现日志的打印。\[2\]这样就可以实现项目中日志框架的统一。
#### 引用[.reference_title]
- *1* [log4j-over-slf4j工作原理详解](https://blog.csdn.net/john1337/article/details/76152906)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [slf4j logback log4j slf4j-log412 log4j-over-slf4j 关系详解](https://blog.csdn.net/asdasd3418/article/details/82840607)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [log4j-over-slf4j的jar包适配原理解析](https://blog.csdn.net/qq_43750656/article/details/125714607)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文