log4j log print mybatis

1 pom.xml add references: three must

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
<version>1.16</version>
</dependency>

2 设置mybatis的配置文件 mybatis-config.xml
<Settings> 
<-! printing log to SLF4J ->
<Setting name = "logImpl" value = "the SLF4J"> </ Setting>
</ Settings>

. 3 log4j attribute is to be noted that the log level DEBUG, in particular of the following two, I did not pay attention to the INFO modified to DEBUG, do not print out the log
log4j.rootLogger=DEBUG,file
log4j.appender.file.Threshold=DEBUG



Guess you like

Origin www.cnblogs.com/lylongs/p/11183954.html