ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Niemeyer <andreas.nieme...@gutzmann.com>
Subject JDBC logging - sql query and bind variables sent via JDBC
Date Sun, 23 Nov 2008 16:08:29 GMT
Hi,

I've seen some postings around this issue.


I would like to see "merged parameters with statements" in my logs, e.g.

   select * from emp where id = '4711'


Options would are

1) an extended log4j configuration
	
2) or the usage of tools like P6Spy or  JAMon for JDBC proxy logging


The P6SPY project seems to be death over years and the jamonapi project 
doesn't take "log sql with real bind variable formatting " into account.


The log4j outcome put me to much info in the logs AND especially the 
assigned parameters and the prepared statement are found in 2 lines.


Maybe an additional log4j property could take this into account?


Or is there a method in the SQLMapClient planned?


I could imagine something like:

SQLMapObject obj = SqlMapClient.getSQLMapObject(name)
obj.setParameterClass(parameterMap)
obj.getSQLFormatted() OR obj.getSQLFormatted(sqlformatMap)
obj.queryForObject() OR obj.queryForList()



Many thanks for some thoughts and hints.


Kind regards,
Andreas




1) log4j config

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, APPENDER_X
log4j.logger.java.sql.ResultSet=DEBUG


2)jdbc proxies

http://www.p6spy.com/
http://jamonapi.sourceforge.net/





Mime
View raw message