Class FormattingJdbcLogger

  • All Implemented Interfaces:
    JdbcLogger

    public class FormattingJdbcLogger
    extends Object
    implements JdbcLogger
    A JdbcLogger that formats SQL statement text before delegating to another logger.
    Author:
    Carl Harris
    • Constructor Detail

      • FormattingJdbcLogger

        public FormattingJdbcLogger​(JdbcLogger delegate)
        Constructs a new instance that uses SimpleSQLFormatter.
        Parameters:
        delegate - logger delegate
      • FormattingJdbcLogger

        public FormattingJdbcLogger​(JdbcLogger delegate,
                                    SQLFormatter formatter)
        Constructs a new instance.
        Parameters:
        delegate - logger delegate
        formatter - formatter
    • Method Detail

      • writeStatement

        public void writeStatement​(String sql)
        Description copied from interface: JdbcLogger
        Writes the text of an SQL statement to the log.
        Specified by:
        writeStatement in interface JdbcLogger
        Parameters:
        sql - the SQL statement text to write
      • writeParameters

        public void writeParameters​(Parameter[] parameters)
        Description copied from interface: JdbcLogger
        Writes the parameters that will be bound for an SQL statement.

        This method is invoked immediately after JdbcLogger.writeStatement(String) to log the actual parameter values that will be used to replace statement placeholders.

        An implementation should check the configuration of the underlying log system as to whether this level of detail is enabled.

        Specified by:
        writeParameters in interface JdbcLogger
        Parameters:
        parameters - values that will be bound before statement execution