ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Thompson <...@rogers.com>
Subject PreparedStatementLogProxy log4j output with bind variables
Date Wed, 11 May 2005 17:30:37 GMT
Hello All,

I was wondering if there was a way to either request a change or if there
was a way to override the current logging output sent to log4j as shown

>From PreparedStatementLogProxy.java

public Object invoke(Object proxy, Method method, Object[] params) throws
Throwable {
    try {
      if (EXECUTE_METHODS.contains(method.getName())) {
        if (log.isDebugEnabled()) {
          log.debug("{pstm-" + id + "} PreparedStatement: " +
          log.debug("{pstm-" + id + "} Parameters: " + getValueString());
          log.debug("{pstm-" + id + "} Types: " + getTypeString());


The invoke() method simply prints the prepared statement with no bind
variable substitution so the statement is printed with the embedded '?'
placeholders.  Is there a way to also include the statement as it would be
sent to the database backend as the actual string with bind variables
replaced.  If not is there a way that this Proxy could implement a SPI
interface and adapter that could be configured as a runtime class that
could have a custom Proxy implementation.

Otherwise as it stands I would have to modify the class and rebundle a
custom jar to change the log4j output ...


View raw message