MyBatis Framework Print SQL statement on console-ground tornado

Source: Internet
Author: User

(-1) write in front

I'm using MyBatis 3.2.4,maven Project.

(0) Mybatis-config.xml

<settings>

<setting name= "Logimpl" value= "log4j"/>

</settings>

(1) Log4j.properties content

Log4j.rootlogger=debug, Console

Log4j.appender.console=org.apache.log4j.consoleappender

Log4j.appender.console.layout=org.apache.log4j.patternlayout

log4j.appender.console.layout.conversionpattern=%d [%t]%-5p [%c]-%m%n

Log4j.logger.java.sql.resultset=info

Log4j.logger.org.apache=info

Log4j.logger.java.sql.connection=debug

Log4j.logger.java.sql.statement=debug

Log4j.logger.java.sql.preparedstatement=debug

B. Location

Src/main/resources under

(3) Results

2016-11-14 22:36:55,173 [main] DEBUG [Com.world.mapper.UserMapper.insertUser]-ooo Using Connection [[email protected]

2016-11-14 22:36:55,174 [main] DEBUG [Com.world.mapper.UserMapper.insertUser]-==> preparing:insert into T_user (use R_name,password,last_visit,credits) VALUES (?,?,?,?)

2016-11-14 22:36:55,227 [main] DEBUG [Com.world.mapper.UserMapper.insertUser]-==> Parameters: Wang (String), 217020 ( String), 2016-11-14 22:36:54.966 (Timestamp), (Integer)

2016-11-14 22:36:55,298 [main] DEBUG [Com.world.mapper.UserMapper.insertUser]-<== updates:1

MyBatis Framework Print SQL statement on console-ground tornado

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.