Ibatis Print full SQL statements in the background

Source: Internet
Author: User

http://blog.csdn.net/deng11342/article/details/9122015

Http://www.blogjava.net/libin2722/archive/2007/12/04/165153.html

Print Ibatis Final SQL statement

At project development, everyone wants to print SQL in the background to help with the development and subsequent bug changes. If using JDBC so can be convenient to print, can use ibatis do not know how to do, recently on the Internet to find a section of log4j configuration can be very nanny to deal with this problem. Put it here for your reference.
Log4j.appender.stdout=org.apache.log4j.consoleappender
Log4j.appender.stdout.layout=org.apache.log4j.patternlayout
log4j.appender.stdout.layout.conversionpattern=%d%p [%c]-%m%n


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,stdout
Put this configuration in the Log4j.properties file.

In the project trial run need to maintain the stage can be debug to error, so that the server background only print error messages, so that both can see errors and reduce the burden on the server (the background is constantly printing data is consuming server resources. )

Ibatis Print full SQL statements in the background

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.