首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

施用ibatis开发Swing程序配置log4j显示ibatis的sql语句

2012-11-05 
使用ibatis开发Swing程序配置log4j显示ibatis的sql语句?? 准备用swing做一个拨号程序,和数据库打交道的地

使用ibatis开发Swing程序配置log4j显示ibatis的sql语句

?? 准备用swing做一个拨号程序,和数据库打交道的地方比较多,所以考虑用ibatis来和数据库交互,在搭框架的时候,调式程序时 sql语句没有被打印出来,所以决定用log4j打印出来,以方便调式。

? 我使用的是netbeans6.0.1,在工程的根目录新建一个log4j.properties的文件,然后在里面加上配置:代码如下:

?

log4j: Parsing for [com.ibatis.common.jdbc.SimpleDataSource] with value=[debug].
log4j: Level token is [debug].
log4j: Category com.ibatis.common.jdbc.SimpleDataSource set to DEBUG
log4j: Handling log4j.additivity.com.ibatis.common.jdbc.SimpleDataSource=[null]
log4j: Parsing for [java.sql.Connection] with value=[debug].
log4j: Level token is [debug].
log4j: Category java.sql.Connection set to DEBUG
log4j: Handling log4j.additivity.java.sql.Connection=[null]
log4j: Parsing for [com.ibatis] with value=[debug].
log4j: Level token is [debug].
log4j: Category com.ibatis set to DEBUG
log4j: Handling log4j.additivity.com.ibatis=[null]
log4j: Parsing for [com.ibatis.common.jdbc.ScriptRunner] with value=[debug].
log4j: Level token is [debug].
log4j: Category com.ibatis.common.jdbc.ScriptRunner set to DEBUG
log4j: Handling log4j.additivity.com.ibatis.common.jdbc.ScriptRunner=[null]
log4j: Parsing for [com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate] with value=[debug].
log4j: Level token is [debug].
log4j: Category com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate set to DEBUG
log4j: Handling log4j.additivity.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=[null]
log4j: Parsing for [java.sql.Statement] with value=[debug].
log4j: Level token is [debug].
log4j: Category java.sql.Statement set to DEBUG
log4j: Handling log4j.additivity.java.sql.Statement=[null]
log4j: Parsing for [java.sql.PreparedStatement] with value=[DEBUG].
log4j: Level token is [DEBUG].
log4j: Category java.sql.PreparedStatement set to DEBUG
log4j: Handling log4j.additivity.java.sql.PreparedStatement=[null]
log4j: Finished configuring.
15:05:23,268 DEBUG SimpleDataSource:27 - Created connection 12707029.
15:05:23,331 DEBUG Connection:27 - {conn-100000} Connection
15:05:23,378 DEBUG Connection:27 - {conn-100000} Preparing Statement: select euser_id as userId,eusernamee as username,eusernamec as usernamec,epassword as password,egroup_id as groupId,elevel_id as levelId,earea_id as areaId,eaddr as address,econtact1 as contactOne,econtact2 as contactTwo,email as email from mc$lg_euser where EUSERNAMEC=?
15:05:27,159 DEBUG PreparedStatement:27 - {pstm-100001} Executing Statement: select euser_id as userId,eusernamee as username,eusernamec as usernamec,epassword as password,egroup_id as groupId,elevel_id as levelId,earea_id as areaId,eaddr as address,econtact1 as contactOne,econtact2 as contactTwo,email as email from mc$lg_euser where EUSERNAMEC=?
15:05:27,190 DEBUG PreparedStatement:27 - {pstm-100001} Parameters: [上帝发誓]
15:05:27,237 DEBUG PreparedStatement:27 - {pstm-100001} Types: [java.lang.String]
15:05:29,612 DEBUG SimpleDataSource:27 - Returned connection 12707029 to pool.
?

?

1 楼 smalltiger1984 2009-05-18   15:05:27,190 DEBUG PreparedStatement:27 - {pstm-100001} Parameters: [上帝发誓 ]
15:05:27,237 DEBUG PreparedStatement:27 - {pstm-100001} Types: [java.lang.String]
15:05:29,612 DEBUG SimpleDataSource:27 - Returned connection 12707029 to pool.

热点排行