网上找了半天,终于按照一篇说的打印成功。具体如下
pom.xml中加入
<dependency>
<groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId>
<version>1.6.6</version>
</dependency>
log4j.properties中加入
log4j.rootCategory=INFO, stdout , R
log4j.logger.com.unionpay.mobscan.dao.ScanRecordMapper=DEBUG //对应mapper中的namespace ,DEBUG只打印SQL语句 TRACE打印结果
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyyMMdd HH:mm:ss} - %p %c - %m%n