Mybatis : DEBUG [main] - PooledDataSource forcefully closed/removed all connections.

出现错误:

  1. DEBUG [main] - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.
  2. DEBUG [main] - Class not found: org.jboss.vfs.VFS
  3. DEBUG [main] - JBoss 6 VFS API is not available in this environment.
  4. DEBUG [main] - Class not found: org.jboss.vfs.VirtualFile
  5. DEBUG [main] - VFS implementation org.apache.ibatis.io.JBoss6VFS is not valid in this environment.
  6. DEBUG [main] - Using VFS adapter org.apache.ibatis.io.DefaultVFS
  7. DEBUG [main] - Find JAR URL: file:/D:/software%20install/chapter09/build/classes/com/itheima/po
  8. DEBUG [main] - Not a JAR: file:/D:/software%20install/chapter09/build/classes/com/itheima/po
  9. DEBUG [main] - Reader entry: idCard.class
  10. DEBUG [main] - Reader entry: Person.class
  11. DEBUG [main] - Listing file:/D:/software%20install/chapter09/build/classes/com/itheima/po
  12. DEBUG [main] - Find JAR URL: file:/D:/software%20install/chapter09/build/classes/com/itheima/po/idCard.class
  13. DEBUG [main] - Not a JAR: file:/D:/software%20install/chapter09/build/classes/com/itheima/po/idCard.class
    ----------------------------部分乱字符无法复制
  14. DEBUG [main] - Checking to see if class com.itheima.po.idCard matches criteria [is assignable to Object]
  15. DEBUG [main] - Checking to see if class com.itheima.po.Person matches criteria [is assignable to Object]
  16. DEBUG [main] - PooledDataSource forcefully closed/removed all connections.
  17. DEBUG [main] - PooledDataSource forcefully closed/removed all connections.
  18. DEBUG [main] - PooledDataSource forcefully closed/removed all connections.
  19. DEBUG [main] - PooledDataSource forcefully closed/removed all connections.
  20. DEBUG [main] - Opening JDBC Connection
  21. DEBUG [main] - Created connection 1800890735.
  22. DEBUG [main] - Setting autocommit to false on JDBC Connection [com.mysql.jdbc.JDBC4Connection@6b57696f]
  23. DEBUG [main] - ==>  Preparing: select * from tb_person where id=? 
  24. DEBUG [main] - ==> Parameters: 2(Integer)
  25. DEBUG [main] - ====>  Preparing: select * from tb_idcard where id=? 
  26. DEBUG [main] - ====> Parameters: 2(Integer)
  27. DEBUG [main] - <====      Total: 1
  28. DEBUG [main] - <==      Total: 1
  29. Person [id=2, name=Tom, age=29, sex=male, card=idCard [id=2, code=440883199808082121]]
  30. DEBUG [main] - Resetting autocommit to true on JDBC Connection [com.mysql.jdbc.JDBC4Connection@6b57696f]
  31. DEBUG [main] - Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@6b57696f]
  32. DEBUG [main] - Returned connection 1800890735 to pool.
     

本人在运行mybatis相关代码时,因为这个问题弄了很久才发现,在网上相关的资料比较少,在此分享给大家!欢迎吐槽!!!

错误日志配置:

  1. # Global logging configuration
  2. log4j.rootLogger=DEBUG, stdout
  3. # Console output...
  4. log4j.appender.stdout=org.apache.log4j.ConsoleAppender
  5. log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
  6. log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

 

正确日志配置:

  1. # Global logging configuration
  2. log4j.rootLogger=ERROR, stdout
  3. # MyBatis logging configuration...
  4. log4j.logger.com.itheima=DEBUG
  5. # Console output...
  6. log4j.appender.stdout=org.apache.log4j.ConsoleAppender
  7. log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
  8. log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

原因:少配置的部分是(正确配置部分)第三/第四行代码,以及第二行DEBUG(错误)和ERROR(正确)不同

你可能感兴趣的:(Eclipse,Mybatis)