猿问

ibaties如何利用log4j在控制台打印sql?

# Set root logger level to DEBUG and its only appender to CONSOLE.
log4j.rootLogger=INFO, CONSOLE,FILE

# CONSOLE out information
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:ss} [%t] %-5p %C{1} : %m%n

# file out information
log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.FILE.File=/home/was/newAgent/newAgent.log
log4j.appender.FILE.MaxFileSize=50000KB
log4j.appender.FILE.MaxBackupIndex=10 
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p %C{1} : %m%n

# LIMIT CATEGORIES
#log4j.logger.org.jbpm=INFO
#log4j.logger.org.jbpm.graph=DEBUG

# Hibernate debugging levels and their output
#log4j.logger.org.hibernate=INFO
# hide optimistic locking failures
#log4j.logger.org.hibernate.event.def.AbstractFlushingEventListener=FATAL
#Log all SQL DML statements as they are executed
#log4j.logger.org.hibernate.SQL=TRACE
#Log all JDBC parameters
#log4j.logger.org.hibernate.type=TRACE
#Log all SQL DDL statements as they are executed
#log4j.logger.org.hibernate.tool.hbm2ddl=DEBUG    
#Log the state of all entities (max 20 entities) associated with the session at flush time
#log4j.logger.org.hibernate.pretty=DEBUG    
#Log all second-level cache activity
#log4j.logger.org.hibernate.cache=DEBUG    
#Log transaction related activity
#log4j.logger.org.hibernate.transaction=DEBUG    
#Log all JDBC resource acquisition
#log4j.logger.org.hibernate.jdbc=TRACE    
#Log HQL and SQL ASTs and other information about query parsing
#log4j.logger.org.hibernate.hql.ast=DEBUG    
#Log all JAAS authorization requests
#log4j.logger.org.hibernate.secure=DEBUG    
#Log everything (a lot of information, but very useful for troubleshooting)
#log4j.logger.org.hibernate=DEBUG    
#log4j.logger.org.hibernate.tools=DEBUG    

胡子哥哥
浏览 458回答 2
2回答

互换的青春

agent 直接监控 mysql 驱动,不论是ibatis/mybatis/sharingJDBC/jdbc驱动,都直接监控。
随时随地看视频慕课网APP

相关分类

Java
我要回答