mybatis不在控制台中打印查询

时间:2019-02-26 10:06:36

标签: eclipse log4j mybatis

我已经关注了很多操作方法,教程,指南和答案(在SO上),但仍然无法在Eclipse的控制台中打印查询(及其结果)...

即使我已尽一切可能,我还是100%确信自己缺少某些东西...

映射器在XML类中。以下是mybatis-config.xml:

    <?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE configuration
  PUBLIC '-//mybatis.org//DTD Config 3.0//EN'
  'http://mybatis.org/dtd/mybatis-3-config.dtd'>
<configuration>
    <typeAliases>
    </typeAlias>
    <mappers>
        <package name="com.app.dao.persistence" />
    </mappers>
    <typeHandlers>
        <package name="com.app.typehandler" />
    </typeHandlers>
    <settings>
    <setting name="logImpl" value="LOG4J"/>
  </settings>
</configuration>

这是log4j.properties:

# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
log4j.rootLogger=warn, stdout, ERROR

log4j.logger.com.app.portal=info, debug
log4j.logger.org.springframework=info
log4j.logger.com.ocpsoft=info

# MyBatis logging configuration...
log4j.logger.com.app.dao.persistence.MyMapper=TRACE

XML显然位于com.app.dao.persistence.MyMapper

0 个答案:

没有答案