配置mybatis里控制台打印sql

时间:2024-10-30 11:50:46
<loggers> 2 <!-- name可以指定包名或具体的类;additivity如果指定true,则root logger也会生效,相同日志会输出两次;false,则只有当前日志文件输出 --> 3 <!-- 借据插入接口日志 --> 4 <logger level="info" name="insertCreditBill" additivity="false"> 5 <appender-ref ref="insertCreditBillLog" /> 6 </logger> 7 8 <!-- 下面是打印通过log4j2打印出mybatis语句的配置--> 9 <logger name=""><!-- 此包名为所有dao的包名--> 10 <level>DEBUG</level> 11 </logger> 12 <logger name=""> 13 <level>DEBUG</level> 14 </logger> 15 <logger name="" additivity="true"> 16 <level>DEBUG</level> 17 </logger> 18 <logger name="" additivity="true"> 19 <level>DEBUG</level> 20 </logger> 21 <logger name="" additivity="true"> 22 <level>DEBUG</level> 23 </logger> 24 <logger name="" additivity="true"> 25 <level>DEBUG</level> 26 </logger> 27 <logger name="" additivity="true"> 28 <level>DEBUG</level> 29 </logger> 30 <logger name="" additivity="true"> 31 <level>DEBUG</level> 32 </logger> 33 <logger name="" additivity="true"> 34 <level>DEBUG</level> 35 </logger> 36 <logger name="" additivity="true"> 37 <level>DEBUG</level> 38 </logger> 39 <logger name="" additivity="true"> 40 <level>DEBUG</level> 41 </logger> 42 43 <!-- root logger,任何其它的logger最终都相当于继承自 root logger --> 44 <root level="INFO"> 45 <appenderRef ref="Console" /> 46 <appenderRef ref="FileLog"></appenderRef> 47 </root> 48 </loggers>