cancel
Showing results for 
Search instead for 
Did you mean: 

How to print ibatis sql log on original REST API application ?

youtianhong
Champ in-the-making
Champ in-the-making
I use original rest-war in my  web application, I want to print the SQL statement log when invoke rest api.
I can print it successufully on non rest API application, but I don't know how to config it for original rest API application.

Who know that  how to config log4j.properties to print SQL statement for original REST API application ?
As we know, activiti use ibatis to do persistence, for REST API application, I tried to modify lots of times, it can not work.

My log4j.properties file like below:
log4j.rootLogger=debug, CA

# ConsoleAppender
log4j.appender.CA=org.apache.log4j.ConsoleAppender
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern= %d{hh:mm:ss,SSS} [%t] %-5p %c %x - %m%n
#The following configuration which i look up on web site that support print ibatis log in non rest API activiti system
org.activiti.engine.impl.persistence.entity=DEBUG
org.activiti.engine.impl=DEBUG
log4j.logger.org.activiti.engine.impl=DEBUG

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,stdout 


When I debug in eclipse and change the value "org.slf4j.impl.JDK14LoggerAdapter.isDebugEnabled" = true  manually,  it will print ibatis sql log. How can i config it ?
Any feedback will be much appreciated. Thanks in advance.

Regards,
Frank
2 REPLIES 2

jbarrez
Star Contributor
Star Contributor

snigdha_girdhar
Champ in-the-making
Champ in-the-making
This does not work for me. I have log4j.properties in my test resources, but I can't see any SQL logs. Is there anything else we need to do?