public static Connection newInstance(Connection conn, Log statementLog, int queryStack) {
    InvocationHandler handler = new ConnectionLogger(conn, statementLog, queryStack);
    ClassLoader cl = Connection.class.getClassLoader();
    return (Connection) Proxy.newProxyInstance(cl, new Class[]{Connection.class}, handler);
  }
Connection proxy to add logging

@author Clinton Begin
@author Eduardo Macarron
src/main/java/org/apache/ibatis/logging/jdbc/ConnectionLogger.java