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 Re: JDBC logging - sql query and bind variables sent via JDBC
Date Fri, 28 Nov 2008 18:51:46 GMT
Hi Kai,

Thank you for responding.

I think it's a must have to see what's going on.


For that I feel motivated to dig into the code (maybe next week):

- finding the places where the sql prepared statements are called
- add log4j stuff and conditions
- define 2 log4j properties to set log level and activation of logging


Regards,
Andreas



Kai Grabfelder schrieb:
> Hi Anreas,
> 
> I'm not 100% sure but I don't think that there is a possibility to log this. I think
you've already mentioned
> the two options that currently do exist.
> 
> Regards
> 
> Kai
> 
> --- Original Nachricht ---
> Absender: Andreas Niemeyer
> Datum: 26.11.2008 15:39
>> Hi,
>>
>> Is there a way to get the sqlmpap object (statements) with optional 
>> dynamic parts?
>>
>> Thank you in advance,
>> Andreas
>>
>>
>>
>> Andreas Niemeyer schrieb:
>>> 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