logback 打印mybatis sql mybatis 日志打印sql语句和返回结果

时间:2024-06-19 08:33:56

logback 打印sql语句:

在logback日志文件中开启debug模式


  1. <logger name="com.ibatis" level="DEBUG" />
  2. <logger name="com.ibatis.common.jdbc.SimpleDataSource" level="DEBUG" />
  3. <logger name="com.ibatis.common.jdbc.ScriptRunner" level="DEBUG" />
  4. <logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate" level="DEBUG" />
  5. <logger name="java.sql.Connection" level="DEBUG" />
  6. <logger name="java.sql.Statement" level="DEBUG" />
  7. <logger name="java.sql.PreparedStatement" level="DEBUG" />
  8. <logger name="java.sql.ResultSet" level="DEBUG" />
  9. <logger name="你的dao的包名" level="DEBUG" />

打印sql返回结果:

在mybatis-config.xml中开启:


  1. <settings>
  2. <setting name="logImpl" value="STDOUT_LOGGING"/>
  3. </settings>

原文地址:https://blog.****.net/qq_25825923/article/details/84255579