P6SPY 是如何工作的?
几乎问题中的所有内容。我刚刚发现 p6spy 与 hibernate 结合使用,看到实际的 sql 查询真的很酷,尽管我对它的工作原理感到非常困惑。
那么它是如何运作的呢?
Pretty much everything in the question. I just discovered p6spy in association with hibernate which is really cool to see the actual sql queries, though I'm quite baffled on how it works.
So how does it work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
p6spy 的基本思想是这样的:
Datasource
还是JDBC driver
,你所做的不是引用真实的,而是指定 p6spy
具体的:分别是
com.p6spy.engine.spy.P6SpyDriver
或com.p6spy.engine.spy.P6DataSource
(有关完整文档,请参阅:p6spy.readthedocs.io/en/latest/configandusage.html)。spy.properties
文件中配置真实的内容(分别使用realdriver
或realdatasource
属性),com.p6spy.engine.logging.P6LogFactory
)appender=com.p6spy.engine.logging.appender.Log4jLogger
)如果对更多详细信息感兴趣,请随时询问,或在以下位置查看项目本身:https://github.com/p6spy/p6spy
the basic idea on p6spy goes like this:
Datasource
or forJDBC driver
in your code,what you do is instead of referring the real ones, you specify p6spy
specific ones:
com.p6spy.engine.spy.P6SpyDriver
orcom.p6spy.engine.spy.P6DataSource
respectively (for full documentation, see: p6spy.readthedocs.io/en/latest/configandusage.html).spy.properties
file (usingrealdriver
orrealdatasource
properties respectively)com.p6spy.engine.logging.P6LogFactory
)appender=com.p6spy.engine.logging.appender.FileLogger
), stdout logger (usingappender=com.p6spy.engine.logging.appender.StdoutLogger
) or log4j logger (using:appender=com.p6spy.engine.logging.appender.Log4jLogger
)If interested in more details, feel free to ask, or check the project itself on: https://github.com/p6spy/p6spy