MyBatis the SQL that is executed in the log log or console print

Source: Internet
Author: User
Tags log log

Recently when debugging code, need to see the current operation of the SQL executed, not found in the log, after modifying the Logback configuration succeeded, is now recorded as follows:
One, MyBatis version is 3.0.6 (I am using the version)
This version only needs to be modified Logback.xml

<logger name= "java.sql.Connection" level= "DEBUG"/>
<logger name= "java.sql.Statement" level= "DEBUG"/>
<logger name= "java.sql.PreparedStatement" level= "DEBUG"/>

Note: The level of the above configuration needs to be consistent or higher with the Logback log print (that is, root)

If you are printing SQL in the Eclipse console, you also need to make sure that you have a stdout configuration:

<root>
<level value= "DEBUG"/>
<appender-ref ref= "stdout"/>
......
</root>
Second, MyBatis version is 3.0.6, this version needs to be modified Logback.xml
<logger name= "DAO" level= "DEBUG"/>

MyBatis the SQL that is executed in the log log or console print

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.