我有一个程序可以使用准备好的语句更新数据库中的表,并且我试图查看所有已实现的 SQL 语句的输出。
我的研究建议 P6Spy 看起来很棒,我下载了它,将 P6Spy.jar 作为依赖项添加到我的库中,修改为 spy.properties 文件以连接以使用 oracle 驱动程序作为真实驱动程序,将 spy.properties 添加到我的类路径,并在我的代码中将驱动程序更改为“com.p6spy.engine.spy.P6SpyDriver”。
一切正常,生成了 spy.log 文件,但它不包含 SQL 语句。相反,spy.log 文件中的输出是:
1374244954573|-1||debug||com.p6spy.engine.common.P6SpyOptions reloading properties
1374244954578|-1||info||Using properties file: C:\Users\gboss\logging\spy.properties
1374244954579|-1||info||No value in environment for: getStackTrace, using: false
1374244954579|-1||info||No value in environment for: getDeregisterDrivers, using: false
1374244954579|-1||info||No value in environment for: getUsePrefix, using: false
1374244954579|-1||info||No value in environment for: getExecutionThreshold, using: 0
1374244954579|-1||info||No value in environment for: getAutoflush, using: true
1374244954579|-1||info||No value in environment for: getExclude, using:
1374244954579|-1||info||No value in environment for: getExcludecategories, using: info,debug,result,batch
1374244954579|-1||info||No value in environment for: getFilter, using: true
1374244954579|-1||info||No value in environment for: getInclude, using:
1374244954579|-1||info||No value in environment for: getIncludecategories, using:
1374244954579|-1||info||No value in environment for: getLogfile, using: c:/spy.log
1374244954579|-1||info||No value in environment for: getAppender, using: com.p6spy.engine.logging.appender.FileLogger
1374244954579|-1||info||No value in environment for: getRealdriver, using: oracle.jdbc.driver.OracleDriver
1374244954579|-1||info||No value in environment for: getRealdriver2, using:
1374244954580|-1||info||No value in environment for: getRealdriver3, using:
1374244954580|-1||info||No value in environment for: getAppend, using: true
1374244954580|-1||info||No value in environment for: getSpydriver, using: com.p6spy.engine.spy.P6SpyDriver
1374244954580|-1||info||No value in environment for: getDateformat, using:
1374244954580|-1||info||No value in environment for: getDateformatter, using: null
1374244954580|-1||info||No value in environment for: getStringmatcher, using: com.p6spy.engine.common.SubstringMatcher
1374244954580|-1||info||No value in environment for: getStringMatcherEngine, using: com.p6spy.engine.common.SubstringMatcher@13aaa14a
1374244954580|-1||info||No value in environment for: getStackTraceClass, using:
1374244954580|-1||info||No value in environment for: getSQLExpression, using: null
1374244954580|-1||info||No value in environment for: getReloadProperties, using: false
1374244954580|-1||info||No value in environment for: getReloadPropertiesInterval, using: 60
1374244954580|-1||info||No value in environment for: getJNDIContextFactory, using: null
1374244954580|-1||info||No value in environment for: getJNDIContextProviderURL, using: null
1374244954580|-1||info||No value in environment for: getJNDIContextCustom, using: null
1374244954580|-1||info||No value in environment for: getRealDataSource, using: null
1374244954580|-1||info||No value in environment for: getRealDataSourceClass, using: null
1374244954580|-1||info||No value in environment for: getRealDataSourceProperties, using: null
有没有人有使用 P6Spy 的经验并且知道问题是什么?我读过 spy.log 只是应该在完成我所做的所有事情并运行程序之后生成 sql 语句,所以我在这里很困惑
编辑——顺便更新了数据库,所以 SQL 语句确实通过并更新了数据库