配置log4j 以便查看mybatis操作数据库的过程
<!--log4j-->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
</dependency>
<!--junit-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
在src/main/resources 中添加log4j.properties配置文件,内容如下
#全局配置 log4j.rootLogger = ERROR,stdout #mybatis 日志配置 log4j.logger.tk.mybatis.simple.mapper=TRACE #控制台输出配置 log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] -%m%n

浙公网安备 33010602011771号