How to use log4j to print sql? in the console of ibaties

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

-sharp 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

-sharp 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

-sharp LIMIT CATEGORIES
-sharplog4j.logger.org.jbpm=INFO
-sharplog4j.logger.org.jbpm.graph=DEBUG

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

Mar.08,2022

you mean iBatis?

iBatis is now called MyBatis

log4j.logger.org.mybatis=DEBUG

you can refer to

http://www.mybatis.org/mybati.


agent

directly monitor mysql drivers, regardless of whether they are ibatis/mybatis/sharingJDBC/jdbc drivers.

Menu