Class ConnectionLogger

  • All Implemented Interfaces:
    java.lang.reflect.InvocationHandler

    public final class ConnectionLogger
    extends BaseJdbcLogger
    implements java.lang.reflect.InvocationHandler
    Connection proxy to add logging.
    • Field Detail

      • connection

        private final java.sql.Connection connection
    • Constructor Detail

      • ConnectionLogger

        private ConnectionLogger​(java.sql.Connection conn,
                                 Log statementLog,
                                 int queryStack)
    • Method Detail

      • invoke

        public java.lang.Object invoke​(java.lang.Object proxy,
                                       java.lang.reflect.Method method,
                                       java.lang.Object[] params)
                                throws java.lang.Throwable
        Specified by:
        invoke in interface java.lang.reflect.InvocationHandler
        Throws:
        java.lang.Throwable
      • newInstance

        public static java.sql.Connection newInstance​(java.sql.Connection conn,
                                                      Log statementLog,
                                                      int queryStack)
        Creates a logging version of a connection.
        Parameters:
        conn - the original connection
        statementLog - the statement log
        queryStack - the query stack
        Returns:
        the connection with logging
      • getConnection

        public java.sql.Connection getConnection()
        return the wrapped connection.
        Returns:
        the connection