Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arganzheng/6035000 to your computer and use it in GitHub Desktop.
Save arganzheng/6035000 to your computer and use it in GitHub Desktop.

如何打印ibatis拼凑的动态SQL语句

log4j.logger.java.sql.PreparedStatement=debug
log4j.logger.java.sql.Connection=debug

将打印出Connection和Statement信息:

[DEBUG] 11:48:17 Connection - {conn-100000} Connection
[DEBUG] 11:48:17 Connection - {conn-100000} Preparing Statement:    select api.id   from t_api_metadata_api api,   t_api_metadata_module module   where api.module_id=module.id   and api.source = ?   and api.name = ?       and     api.module_id = ?        and     module.name = ?         
[DEBUG] 11:48:17 PreparedStatement - {pstm-100001} Executing Statement:    select api.id   from t_api_metadata_api api,   t_api_metadata_module module   where api.module_id=module.id   and api.source = ?   and api.name = ?       and     api.module_id = ?        and     module.name = ?         
[DEBUG] 11:48:17 PreparedStatement - {pstm-100001} Parameters: [wanggou, PdfTransform, 41, null]
[DEBUG] 11:48:17 PreparedStatement - {pstm-100001} Types: [java.lang.String, java.lang.String, java.lang.Integer, null]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment