log4j 打印sql

有兩個工程一樣的環境(mybatis+spring mvc+spring+maven)一樣的log4j配置,有一個能正常打印sql,有一個死活不打印,info信息等都能輸出就是不輸出sql,添加slf4j包以後又能正常打印,想不通到底爲啥呢。有大神但願指點下。java

slf4j包:web

    <dependency>spring

        <groupId>org.slf4j</groupId>sql

<artifactId>slf4j-log4j12</artifactId>apache

<version>1.7.5</version>api

</dependency>mybatis

        <dependency>mvc

<groupId>org.slf4j</groupId>app

<artifactId>slf4j-api</artifactId>maven

<version>1.7.5</version>

</dependency>

log4j配置文件:

log4j.rootLogger=debug,stdout,info,debug,error

log4j.appender.stdout=org.apache.log4j.ConsoleAppender

log4j.appender.stdout.Threshold = DEBUG 

log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

log4j.appender.stdout.layout.ConversionPattern=[%-5p] [%d{HH:mm:ss}] %c - %m%n

 

log4j.logger.info=info

log4j.appender.info=org.apache.log4j.DailyRollingFileAppender

log4j.appender.info.layout=org.apache.log4j.PatternLayout

log4j.appender.info.layout.ConversionPattern=[%-5p] [%d{HH:mm:ss}] %c - %m%n

log4j.appender.info.datePattern='.'yyyy-MM-dd

log4j.appender.info.Threshold = INFO 

log4j.appender.info.append=true

log4j.appender.info.File=d:/log/travelguide2.0-web.log

 

log4j.logger.debug=debug

log4j.appender.debug=org.apache.log4j.DailyRollingFileAppender

log4j.appender.debug.layout=org.apache.log4j.PatternLayout

log4j.appender.debug.layout.ConversionPattern=[%-5p] [%d{HH:mm:ss}] %c - %m%n

log4j.appender.debug.datePattern='.'yyyy-MM-dd

log4j.appender.debug.Threshold = DEBUG 

log4j.appender.debug.append=true

log4j.appender.debug.File=d:/log/travelguide2.0-web.log


log4j.logger.error=error

log4j.appender.error=org.apache.log4j.DailyRollingFileAppender

log4j.appender.error.layout=org.apache.log4j.PatternLayout

log4j.appender.error.layout.ConversionPattern=[%-5p] [%d{HH:mm:ss}] %c - %m%n

log4j.appender.error.datePattern='.'yyyy-MM-dd

log4j.appender.error.Threshold = ERROR 

log4j.appender.error.append=true

log4j.appender.error.File=d:/log/travelguide2.0-web.log


log4j.logger.com.ibatis=debug  

log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=debug  

log4j.logger.com.ibatis.common.jdbc.ScriptRunner=debug  

log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=debug 

log4j.logger.java.sql.Connection=debug 

log4j.logger.java.sql.Statement=debug 

log4j.logger.java.sql.PreparedStatement=debug

相關文章
相關標籤/搜索