SQL日志Java开源类库,P6SPY 2.0 发布

jopen 10年前

P6Spy是一个可以用来在Java应用程序中拦截和修改数据库SQL操作语句的开源框架。 通过P6Spy我们可以对SQL语句进行拦截,相当于一个SQL语句的日志工具,可以用它来作相关的分析,比如性能分析。

P6SPY提供了如下几个功能:

记录SQL语句的执行时间戳。
记录SQL语句类型
记录SQL填入参数的和没有填入参数的SQL语句
根据配置的时间控制SQL语句的执行时间,对超出时间的SQL语句输出到日志文件中。

下载地址:https://github.com/p6spy/p6spy/wiki/Download

详细改进内容包括:

  • project hosting was moved from sourceforge to github,

  • major part of the legacy code was refactored,

  • Java 6/7 JDBC API support introduced,

  • proxying via modified JDBC URLs only was implemented,
    So for for MySQL original url would be:

    jdbc:mysql://<hostname>:<port>/<database>

    the one proxied via p6spy would one:

    jdbc:p6spy:mysql://<hostname>:<port>/<database>

    without a need for any further configuration,

  • XA Datasource support has been introduced,

  • configuration via:

    • system/environment properties and

    • JMX properties

    • as an alternative to file configuration only

    • or even zero config use case supported,

  • slf4j support (more flexible as previously used log4j),

  • junit tests were migrated to junit 4 (well most of the old ones were failing anyway),

  • Continuous integration using Travis was setup providing testing on popular:

    • DB systems (namely: Oracle, DB2, PostgreSQL, MySQL, H2, HSQLDB, SQLite, Firebird, and Derby), see build status on: travis-ci as well as

    • application servers (namely: Wildfly 8, JBoss 4.2, 5.1, 6.1, 7.1, Glassfish 3.1, 4.0, Jetty 7.6, 8.1, 9.1, Tomcat 6, 7, 8, Resin 4, Jonas 5.3 and Geronimo 2.1, 2.2), see build status on: travis-ci.

完整的改进记录请看 2.0.0-alpha12.0.0.