쿼리 로그 잘 남기기

 

1) Mybatis에 있는 것 활용

 

<bean id="adminDataSource" class="org.apache.ibatis.datasource.pooled.PooledDataSource">

<property name="driverProperties">
    <map>
        <entry key="logger" value="com.mysql.jdbc.log.Slf4JLogger" />
        <entry key="logSlowQueries" value="true" />
        <entry key="useUsageAdvisor" value="false" />
        <entry key="profileSql" value="false" />
        <entry key="autoGenerateTestcaseScript" value="true" />
    </map>
</property>

 

 

2) log4jdbc

 

  <property name="driverClassName" value="net.sf.log4jdbc.DriverSpy"/>

  <property name="url" value="jdbc:log4jdbc:derby://localhost:1527//db-derby-10.2.2.0-bin/databases/MyDatabase” />

 

참고 자료

http://code.google.com/p/log4jdbc/

http://www.mimul.com/pebble/default/2008/10/24/1224847200000.html

 

 

나중에 이슈를 잡기 위해서 log4jdbc를 활용하는 것은 좋은 방법일듯.

Posted by '김용환'
,