1. 程式人生 > >log4j不列印sql,不輸出日誌檔案到指定目錄

log4j不列印sql,不輸出日誌檔案到指定目錄

#log4j.rootLogger=CONSOLE,info,error,DEBUG
log4j.rootLogger=infoA,errorA,CONSOLE,DEBUGA  //注意這裡不要用INFO,DEBUG等 改個名字

log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender     
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout     
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd-HH-mm} [%t] [%c] [%p] - %m%n     
      
log4j.logger.infoA=info
log4j.appender.infoA=org.apache.log4j.DailyRollingFileAppender
log4j.appender.infoA.layout=org.apache.log4j.PatternLayout     
log4j.appender.infoA.layout.ConversionPattern=%d{yyyy-MM-dd-HH-mm} [%t] [%c] [%p] - %m%n  
log4j.appender.infoA.datePattern=yyyy-MM-dd'.log'
log4j.appender.infoA.Threshold = info   
log4j.appender.infoA.append=true   
#log4j.appender.info.File=/home/admin/pms-api-services/logs/info/api_services_info
log4j.appender.info.File=d:/log/info.log

log4j.logger.errorA=error  
log4j.appender.errorA=org.apache.log4j.DailyRollingFileAppender
log4j.appender.errorA.layout=org.apache.log4j.PatternLayout     
log4j.appender.errorA.layout.ConversionPattern=%d{yyyy-MM-dd-HH-mm} [%t] [%c] [%p] - %m%n  
log4j.appender.errorA.datePattern=yyyy-MM-dd'.log'
log4j.appender.errorA.Threshold = error   
log4j.appender.errorA.append=true   
#log4j.appender.error.File=/home/admin/pms-api-services/logs/error/api_services_error
log4j.appender.error.File=d:/log/error.log

log4j.logger.DEBUGA=DEBUG
log4j.appender.DEBUGA=org.apache.log4j.DailyRollingFileAppender
log4j.appender.DEBUGA.layout=org.apache.log4j.PatternLayout     
log4j.appender.DEBUGA.layout.ConversionPattern=%d{yyyy-MM-dd-HH-mm} [%t] [%c] [%p] - %m%n  
log4j.appender.DEBUGA.datePattern=yyyy-MM-dd-HH-mm'.log'//這裡是字尾
log4j.appender.DEBUGA.Threshold = DEBUG   
log4j.appender.DEBUGA.append=true   
#log4j.appender.DEBUG.File=/home/admin/pms-api-services/logs/debug/api_services_debug
log4j.appender.DEBUGA.File=d:/log/debug_log  //這裡設定檔案字首,加個符號,不然報錯

### Debug
log4j.logger.com.ibatis=DEBUG
log4j.logger.java.sql.ResultSet=INFO  
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