java使用slf4j和log4j与单独使用log4j相比,是否存在性能开销?
我正在考虑将Java1.4.2项目从log4j迁移到slf4j。这是参数化日志记录和代码清晰性的优点(如果log.isdebug..,则无需使用)这正吸引着我去考虑这些问题
转换为slf4j是否存在性能开销
上次我检查是否可以使用logback时,它在jdk上有一个要求,要求它至少达到1.5,这就是我考虑使用slf4j和log4j的原因
你可以在下面搜索框中键入要查询的问题!
我正在考虑将Java1.4.2项目从log4j迁移到slf4j。这是参数化日志记录和代码清晰性的优点(如果log.isdebug..,则无需使用)这正吸引着我去考虑这些问题
转换为slf4j是否存在性能开销
上次我检查是否可以使用logback时,它在jdk上有一个要求,要求它至少达到1.5,这就是我考虑使用slf4j和log4j的原因
# 1 楼答案
不,如果有的话,您应该从slf4j获得性能优势,因为(如果您使用参数化消息)然后slf4j defers turning its parameters to strings until it has checked that the message won't be filtered out by log level: