在mybatis的jar包里有一个log4j的jar包,放入项目的lib里
然后加上log4j的配置文件放入资源文件夹
打开log4j.rootLogger=DEBUG
log4j.rootLogger=DEBUG,CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Target=System.out
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%m%n
关闭log4j.rootLogger=ERROR
或者log4j.rootLogger=INFO
log4j.rootLogger=ERROR,CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Target=System.out
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%m%n
然后在mybatis-config配置文件里<setting name="logImpl" value="LOG4J"/>
然后控制台就可以看到各种信息