Mybatis默认使用有slf4j
必须加上依赖
org.slf4j slf4j-log4j12 1.7.5 org.slf4j slf4j-api 1.7.5
否则是怎么配置log4j都是无法打印mybatis的sql到日志
log4j配置
# Direct log messages to consolelog4j.appender.console=org.apache.log4j.ConsoleAppenderlog4j.appender.console.Target=System.outlog4j.appender.console.layout=org.apache.log4j.PatternLayoutlog4j.appender.console.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n # Root logger optionlog4j.rootLogger=debug,console