There are two ways: first planted into the configuration file, the second increase mybatis configuration file code
The first method: the implant profile, properties
File name: log4j.properties
content:
# Global logging configuration\uff0c\u5efa\u8bae\u5f00\u53d1\u73af\u5883\u4e2d\u8981\u7528debug
log4j.rootLogger=DEBUG, stdout
# 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
Placement:
Into the controller layer -resources, just check out the content can only see, can not see, sql statement is executed
-Resources into the service layer or layers -resources in dao, only to see the sql statement, see the contents to be queried
The print more content, more cumbersome relative to the second method, the second method is recommended
The second method: Increase xml file code
Code content:
<Settings>
<-! start print log ->
<Setting name = "logImpl" value = "STDOUT_LOGGING" />
</ Settings>
placement:
xml configuration file dao layer