Class SqlStatementLogger

    • Constructor Detail

      • SqlStatementLogger

        public SqlStatementLogger()
        Constructs a new SqlStatementLogger instance.
      • SqlStatementLogger

        public SqlStatementLogger​(boolean logToStdout,
                                  boolean format)
        Constructs a new SqlStatementLogger instance.
        Parameters:
        logToStdout - Should we log to STDOUT in addition to our internal logger.
        format - Should we format the statements in the console and log
      • SqlStatementLogger

        public SqlStatementLogger​(boolean logToStdout,
                                  boolean format,
                                  boolean highlight)
        Constructs a new SqlStatementLogger instance.
        Parameters:
        logToStdout - Should we log to STDOUT in addition to our internal logger.
        format - Should we format the statements in the console and log
        highlight - Should we highlight the statements in the console
      • SqlStatementLogger

        public SqlStatementLogger​(boolean logToStdout,
                                  boolean format,
                                  boolean highlight,
                                  long logSlowQuery)
        Constructs a new SqlStatementLogger instance.
        Parameters:
        logToStdout - Should we log to STDOUT in addition to our internal logger.
        format - Should we format the statements in the console and log
        highlight - Should we highlight the statements in the console
        logSlowQuery - Should we logs query which executed slower than specified milliseconds. 0 - disabled.
    • Method Detail

      • isLogToStdout

        public boolean isLogToStdout()
        Are we currently logging to stdout?
        Returns:
        True if we are currently logging to stdout; false otherwise.
      • isFormat

        public boolean isFormat()
      • getLogSlowQuery

        public long getLogSlowQuery()
      • logStatement

        public void logStatement​(String statement)
        Log a SQL statement string.
        Parameters:
        statement - The SQL statement.
      • logStatement

        public void logStatement​(String statement,
                                 Formatter formatter)
        Log a SQL statement string using the specified formatter
        Parameters:
        statement - The SQL statement.
        formatter - The formatter to use.
      • logSlowQuery

        public void logSlowQuery​(Statement statement,
                                 long startTimeNanos)
        Log a slow SQL query
        Parameters:
        statement - SQL statement.
        startTimeNanos - Start time in nanoseconds.
      • logSlowQuery

        public void logSlowQuery​(String sql,
                                 long startTimeNanos)
        Log a slow SQL query
        Parameters:
        sql - The SQL query.
        startTimeNanos - Start time in nanoseconds.