iBATIS uses commons-logging to log these.
iBatis用commons-logging来记录这些日志。
Depending on your logging implementation, your configuration may vary.
依赖于你的日志实现,你的配置可能改变。
If you are using log4j, put this line into log4j.properties:
如果你用log4j,把下面这行放入log4j.properties:
log4j.logger.java.sql=DEBUG
If you set your default log level to DEBUG, that will work, too...but you will get debug level logging for everything in the world.
如果你设置默认的日志级别为DEBUG,他将工作,但是你获得全世界每个debug级别的日志。
Here is another example of how to configure ibatis with log4j using an xml config file.
下面是另一个例子,怎么样用xml格式的log4j配置ibatis
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http:>
<!-- Console output -->
<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d{MM-dd HH:mm:ss} %m (%F:%L) \n"/>
</layout>
</appender>
<category name="com.ibatis">
<priority value="debug" />
</category>
<category name="java.sql">
<priority value="debug" />
</category>
<!--The root category defines the top level of appenders all catagories inherit -->
<root>
<priority value ="error" />
<appender-ref ref="STDOUT" />
</root>
</log4j:configuration>
A common question is "Is it possible to show the ACTUAL query being executed?".
一个更通常的问题:有可能展示某个真正的查询被执行了吗?
The simple answer is NO.
简单得回答:没有
Why? Because the only information we have available is the PreparedStatement and the parameters.
为什么?因为我们只能获得preparestatement和参数
Quite often, in the process of applying those parameters to the mapped statement it will become very clear where issues lie in the execution of the query.
更经常,在把参数匹配到statement这个过程中,很明显能看出查询过程哪里有问题。
If you feel that you NEED to see the completed query, you may be interested in hooking up a debugging tool like p6spy, as it may answer your questions for you.
如果你项看到完整得查询,你最好用p6spy这样得debug工具。
For WebSphere-specific instructions see also How do I Configure Logging in WebSphere.
Websphare规范简介参考W@!#%@%RQEWRWQR