iBATIS uses commons-logging to log these.
iBatis用commons-logging來記錄這些日志。
Depending on your logging implementation, your configuration may vary.
依賴于你的日志實(shí)現(xiàn),你的配置可能改變。
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.
如果你設(shè)置默認(rèn)的日志級別為DEBUG,他將工作,但是你獲得全世界每個(gè)debug級別的日志。
Here is another example of how to configure ibatis with log4j using an xml config file.
下面是另一個(gè)例子,怎么樣用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?".
一個(gè)更通常的問題:有可能展示某個(gè)真正的查詢被執(zhí)行了嗎?
The simple answer is NO.
簡單得回答:沒有
Why? Because the only information we have available is the PreparedStatement and the parameters.
為什么?因?yàn)槲覀冎荒塬@得preparestatement和參數(shù)
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.
更經(jīng)常,在把參數(shù)匹配到statement這個(gè)過程中,很明顯能看出查詢過程哪里有問題。
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.
如果你項(xiàng)看到完整得查詢,你最好用p6spy這樣得debug工具。
For WebSphere-specific instructions see also How do I Configure Logging in WebSphere.
Websphare規(guī)范簡介參考W@!#%@%RQEWRWQR