[log4j 설정] log4j, log4sql 로그(log)에 쿼리 행 변경, 파라미터 대입 출력하여 보기
log4j 설정으로 s
log4sql.jar
ql 실행로그를 변경한다.
개행없이, 파라미터가 여러개 일 경우 ?에 모두 대입하여 보려면 불편하지 않나?
1. WEB-INF/lib/ 위치에 log4sql.jar를 추가.
http://log4sql.sourceforge.net/index_kr.html
http://sourceforge.net/projects/log4sql/files/
2. log4j.properties 설정
아래 설정 붙여 넣기.
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
log4j.logger.java.sql.ResultSet=DEBUG
3. driverClassName 수정
driverClassName을 아래와 같이 변경한다.(value)
(이클립스(eclipse)의 server.xml 파일이나 톰캣(tomcat)의 context-datasource.xml)
<property name="driverClassName" value="core.log.jdbc.driver.OracleDriver"/>
DB에 따라 driverClassName이 다르니 아래 표 참조.
참조 : http://log4sql.sourceforge.net/index_kr.html
JDBC TYPE |
Origin Your Driver Class |
log4sql Driver Class |
[ORACLE DRIVER CLASS] |
oracle.jdbc.drirver.OracleDriver |
core.log.jdbc.driver.OracleDriver |
[MYSQL DRIVER CLASS] |
com.mysql.jdbc.Driver' or'org.gjt.mm.mysql.Driver |
core.log.jdbc.driver.MysqlDriver |
[SYSBASE DRIVER CLASS] |
com.sybase.jdbc2.jdbc.SybDriver |
core.log.jdbc.driver.SybaseDriver |
[DB2 DRIVER CLASS] |
com.ibm.db2.jcc.DB2Driver |
core.log.jdbc.driver.DB2Driver |
[INFOMIX DRIVER CLASS] |
com.informix.jdbc.IfxDriver |
core.log.jdbc.driver.InfomixDriver |
[POSTGRESQL DRIVER CLASS] |
org.postgresql.Driver |
core.log.jdbc.driver.PostgresqlDriver |
[MAXDB DRIVER CLASS] |
com.sap.dbtech.jdbc.DriverSapDB |
core.log.jdbc.driver.MaxDBDriver |
[FRONTBASE DRIVER CLASS] |
com.frontbase.jdbc.FBJDriver |
core.log.jdbc.driver.FrontBaseDriver |
[HSQL DRIVER CLASS] |
org.hsqldb.jdbcDriver |
core.log.jdbc.driver.HSQLDriver |
[POINTBASE DRIVER CLASS] |
com.pointbase.jdbc.jdbcUniversalDriver |
core.log.jdbc.driver.PointBaseDriver |
[MIMER DIRVER CLASS] |
com.mimer.jdbc.Driver |
core.log.jdbc.driver.MimerDriver |
[PERVASIVE DRIVER CLASS] |
com.pervasive.jdbc.v2.Driver |
core.log.jdbc.driver.PervasiveDriver |
[DAFFODILDB DRIVER CLASS] |
in.co.daffodil.db.jdbc.DaffodilDBDriver |
core.log.jdbc.driver.DaffodiLDBDriver |
[JDATASTORE DRIVER CLASS] |
com.borland.datastore.jdbc.DataStoreDriver |
core.log.jdbc.driver.JdataStoreDriver |
[CACHE DRIVER CLASS] |
com.intersys.jdbc.CacheDriver |
core.log.jdbc.driver.CacheDriver |
[DERBY DRIVER CLASS] |
org.apache.derby.jdbc.ClientDriver |
core.log.jdbc.driver.DerbyDriver |
[ALTIBASE DRIVER CLASS] |
Altibase.jdbc.driver.AltibaseDriver |
core.log.jdbc.driver.AltibaseDriver |
[MCKOI DRIVER CLASS] |
com.mckoi.JDBCDriver |
core.log.jdbc.driver.MckoiDriver |
[JSQL DRIVER CLASS] |
com.jnetdirect.jsql.JSQLDriver |
core.log.jdbc.driver.JsqlDriver |
[JTURBO DRIVER CLASS] |
com.newatlanta.jturbo.driver.Driver |
core.log.jdbc.driver.JturboDriver |
[JTDS DRIVER CLASS] |
net.sourceforge.jtds.jdbc.Driver |
core.log.jdbc.driver.JTdsDriver |
[INTERCLIENT DRIVER CLASS] |
interbase.interclient.Driver |
core.log.jdbc.driver.InterClientDriver |
[PURE JAVA DRIVER CLASS] |
org.firebirdsql.jdbc.FBDriver |
core.log.jdbc.driver.PureJavaDriver |
[JDBC-ODBC DRIVER CLASS] |
sun.jdbc.odbc.JdbcOdbcDriver |
core.log.jdbc.driver.JdbcOdbcDriver |
[MSSQL 2000 DRIVER CLASS] |
com.microsoft.jdbc.sqlserver.SQLServerDriver |
core.log.jdbc.driver.MssqlDriver |
[MSSQL 2005 DRIVER CLASS] |
com.microsoft.sqlserver.jdbc.SQLServerDriver |
core.log.jdbc.driver.Mssql2005Driver |
[cubrid driver class] |
cubrid.jdbc.driver.CUBRIDDriver |
core.log.jdbc.driver.CUBRIDDriver |