Class AbstractJdbcLogger<LEVEL>

java.lang.Object
org.seasar.doma.jdbc.AbstractJdbcLogger<LEVEL>
Type Parameters:
LEVEL - The log level
All Implemented Interfaces:
JdbcLogger
Direct Known Subclasses:
UtilLoggingJdbcLogger

public abstract class AbstractJdbcLogger<LEVEL> extends Object implements JdbcLogger
A skeletal implementation of the JdbcLogger interface.
  • Field Details

    • defaultLevel

      protected LEVEL defaultLevel
      the default log level
  • Constructor Details

    • AbstractJdbcLogger

      protected AbstractJdbcLogger(LEVEL level)
      Creates an instance with a log level.
      Parameters:
      level - the log level
  • Method Details

    • log

      protected abstract void log(LEVEL level, String callerClassName, String callerMethodName, Throwable throwable, Supplier<String> messageSupplier)
      Logs an error or an exception.
      Parameters:
      level - the log level
      callerClassName - the caller class name
      callerMethodName - the caller method name
      throwable - the error or exception
      messageSupplier - the message supplier
    • logDaoMethodEntering

      public void logDaoMethodEntering(String callerClassName, String callerMethodName, Object... args)
      Description copied from interface: JdbcLogger
      Logs the start of a DAO method.
      Specified by:
      logDaoMethodEntering in interface JdbcLogger
      Parameters:
      callerClassName - the name of the DAO class
      callerMethodName - the name of the DAO method
      args - the arguments of the DAO method
    • logDaoMethodEntering

      protected void logDaoMethodEntering(String callerClassName, String callerMethodName, Object[] args, LEVEL level, Supplier<String> messageSupplier)
    • logDaoMethodExiting

      public void logDaoMethodExiting(String callerClassName, String callerMethodName, Object result)
      Description copied from interface: JdbcLogger
      Logs the normal end of a DAO method.

      At the end of the DAO method, either this method or JdbcLogger.logDaoMethodThrowing(String, String, RuntimeException) must be invoked.

      Specified by:
      logDaoMethodExiting in interface JdbcLogger
      Parameters:
      callerClassName - the name of the DAO class
      callerMethodName - the name of the DAO method
      result - the method result or null if the method return type is void
    • logDaoMethodExiting

      protected void logDaoMethodExiting(String callerClassName, String callerMethodName, Object result, LEVEL level, Supplier<String> messageSupplier)
    • logDaoMethodThrowing

      public void logDaoMethodThrowing(String callerClassName, String callerMethodName, RuntimeException e)
      Description copied from interface: JdbcLogger
      Logs the abnormal end of a DAO method.

      At the end of the DAO method, either this method or JdbcLogger.logDaoMethodExiting(String, String, Object) must be invoked.

      Specified by:
      logDaoMethodThrowing in interface JdbcLogger
      Parameters:
      callerClassName - the name of the DAO class
      callerMethodName - the name of the DAO method
      e - the runtime exception
    • logDaoMethodThrowing

      protected void logDaoMethodThrowing(String callerClassName, String callerMethodName, RuntimeException e, LEVEL level, Supplier<String> messageSupplier)
    • logSqlExecutionSkipping

      public void logSqlExecutionSkipping(String callerClassName, String callerMethodName, SqlExecutionSkipCause cause)
      Description copied from interface: JdbcLogger
      Logs a skip of an SQL execution.
      Specified by:
      logSqlExecutionSkipping in interface JdbcLogger
      Parameters:
      callerClassName - the caller class name
      callerMethodName - the caller method name
      cause - the cause of the skip
    • logSqlExecutionSkipping

      protected void logSqlExecutionSkipping(String callerClassName, String callerMethodName, SqlExecutionSkipCause cause, LEVEL level, Supplier<String> messageSupplier)
    • logSql

      public void logSql(String callerClassName, String callerMethodName, Sql<?> sql)
      Description copied from interface: JdbcLogger
      Logs an SQL statement.
      Specified by:
      logSql in interface JdbcLogger
      Parameters:
      callerClassName - the caller class name
      callerMethodName - the caller method name
      sql - SQL
    • logSql

      protected void logSql(String callerClassName, String callerMethodName, Sql<?> sql, LEVEL level, Supplier<String> messageSupplier)
    • getSqlText

      protected String getSqlText(Sql<?> sql)
    • logTransactionBegun

      public void logTransactionBegun(String callerClassName, String callerMethodName, String transactionId)
      Description copied from interface: JdbcLogger
      Logs a beginning of a transaction.
      Specified by:
      logTransactionBegun in interface JdbcLogger
      Parameters:
      callerClassName - the caller class name
      callerMethodName - the caller method name
      transactionId - the transaction id
    • logTransactionBegun

      protected void logTransactionBegun(String callerClassName, String callerMethodName, String transactionId, LEVEL level, Supplier<String> messageSupplier)
    • logTransactionEnded

      public void logTransactionEnded(String callerClassName, String callerMethodName, String transactionId)
      Description copied from interface: JdbcLogger
      Logs an end of a transaction.
      Specified by:
      logTransactionEnded in interface JdbcLogger
      Parameters:
      callerClassName - the caller class name
      callerMethodName - the caller method name
      transactionId - the transaction id
    • logTransactionEnded

      protected void logTransactionEnded(String callerClassName, String callerMethodName, String transactionId, LEVEL level, Supplier<String> messageSupplier)
    • logTransactionSavepointCreated

      public void logTransactionSavepointCreated(String callerClassName, String callerMethodName, String transactionId, String savepointName)
      Description copied from interface: JdbcLogger
      Logs a creation of a save point.
      Specified by:
      logTransactionSavepointCreated in interface JdbcLogger
      Parameters:
      callerClassName - the caller class name
      callerMethodName - the caller method name
      transactionId - the transaction id
      savepointName - the save point name
    • logTransactionSavepointCreated

      protected void logTransactionSavepointCreated(String callerClassName, String callerMethodName, String transactionId, String savepointName, LEVEL level, Supplier<String> messageSupplier)
    • logTransactionCommitted

      public void logTransactionCommitted(String callerClassName, String callerMethodName, String transactionId)
      Description copied from interface: JdbcLogger
      Logs a commit of a transaction.
      Specified by:
      logTransactionCommitted in interface JdbcLogger
      Parameters:
      callerClassName - the caller class name
      callerMethodName - the caller method name
      transactionId - the transaction id
    • logTransactionCommitted

      protected void logTransactionCommitted(String callerClassName, String callerMethodName, String transactionId, LEVEL level, Supplier<String> messageSupplier)
    • logTransactionRolledback

      public void logTransactionRolledback(String callerClassName, String callerMethodName, String transactionId)
      Description copied from interface: JdbcLogger
      Logs a rollback of a transaction.
      Specified by:
      logTransactionRolledback in interface JdbcLogger
      Parameters:
      callerClassName - the caller class name
      callerMethodName - the caller method name
      transactionId - the transaction id
    • logTransactionRolledback

      protected void logTransactionRolledback(String callerClassName, String callerMethodName, String transactionId, LEVEL level, Supplier<String> messageSupplier)
    • logTransactionSavepointRolledback

      public void logTransactionSavepointRolledback(String callerClassName, String callerMethodName, String transactionId, String savepointName)
      Description copied from interface: JdbcLogger
      Logs a rollback of a save point.
      Specified by:
      logTransactionSavepointRolledback in interface JdbcLogger
      Parameters:
      callerClassName - the caller class name
      callerMethodName - the caller method name
      transactionId - the transaction id
      savepointName - the save point name
    • logTransactionSavepointRolledback

      protected void logTransactionSavepointRolledback(String callerClassName, String callerMethodName, String transactionId, String savepointName, LEVEL level, Supplier<String> messageSupplier)
    • logTransactionSavepointReleased

      public void logTransactionSavepointReleased(String callerClassName, String callerMethodName, String transactionId, String savepointName)
      Description copied from interface: JdbcLogger
      Logs a release of a save point.
      Specified by:
      logTransactionSavepointReleased in interface JdbcLogger
      Parameters:
      callerClassName - the caller class name
      callerMethodName - the caller method name
      transactionId - the transaction id
      savepointName - the save point name
    • logTransactionSavepointReleased

      protected void logTransactionSavepointReleased(String callerClassName, String callerMethodName, String transactionId, String savepointName, LEVEL level, Supplier<String> messageSupplier)
    • logTransactionRollbackFailure

      public void logTransactionRollbackFailure(String callerClassName, String callerMethodName, String transactionId, SQLException e)
      Description copied from interface: JdbcLogger
      Logs a failure of a transaction rollback.
      Specified by:
      logTransactionRollbackFailure in interface JdbcLogger
      Parameters:
      callerClassName - the caller class name
      callerMethodName - the caller method name
      transactionId - the transaction id
      e - the cause of the failure
    • logTransactionRollbackFailure

      protected void logTransactionRollbackFailure(String callerClassName, String callerMethodName, SQLException e, LEVEL level, Supplier<String> messageSupplier)
    • logAutoCommitEnablingFailure

      public void logAutoCommitEnablingFailure(String callerClassName, String callerMethodName, SQLException e)
      Description copied from interface: JdbcLogger
      Logs a failure of an auto commit enabling.
      Specified by:
      logAutoCommitEnablingFailure in interface JdbcLogger
      Parameters:
      callerClassName - the caller class name
      callerMethodName - the caller method name
      e - the cause of the failure
      See Also:
    • logAutoCommitEnablingFailure

      protected void logAutoCommitEnablingFailure(String callerClassName, String callerMethodName, SQLException e, LEVEL level, Supplier<String> messageSupplier)
    • logTransactionIsolationSettingFailure

      public void logTransactionIsolationSettingFailure(String callerClassName, String callerMethodName, int transactionIsolationLevel, SQLException e)
      Description copied from interface: JdbcLogger
      Logs a failure of a transaction isolation setting.
      Specified by:
      logTransactionIsolationSettingFailure in interface JdbcLogger
      Parameters:
      callerClassName - the caller class name
      callerMethodName - the caller method name
      transactionIsolationLevel - the transaction isolation level
      e - the cause of the failure
      See Also:
    • logTransactionIsolationSettingFailure

      protected void logTransactionIsolationSettingFailure(String callerClassName, String callerMethodName, int transactionIsolationLevel, SQLException e, LEVEL level, Supplier<String> messageSupplier)
    • logConnectionClosingFailure

      public void logConnectionClosingFailure(String callerClassName, String callerMethodName, SQLException e)
      Description copied from interface: JdbcLogger
      Logs a failure of a connection close.
      Specified by:
      logConnectionClosingFailure in interface JdbcLogger
      Parameters:
      callerClassName - the caller class name
      callerMethodName - the caller method name
      e - the cause of the failure
      See Also:
    • logConnectionClosingFailure

      protected void logConnectionClosingFailure(String callerClassName, String callerMethodName, SQLException e, LEVEL level, Supplier<String> messageSupplier)
    • logStatementClosingFailure

      public void logStatementClosingFailure(String callerClassName, String callerMethodName, SQLException e)
      Description copied from interface: JdbcLogger
      Logs a failure of a statement close.
      Specified by:
      logStatementClosingFailure in interface JdbcLogger
      Parameters:
      callerClassName - the caller class name
      callerMethodName - the caller method name
      e - the cause of the failure
      See Also:
    • logStatementClosingFailure

      protected void logStatementClosingFailure(String callerClassName, String callerMethodName, SQLException e, LEVEL level, Supplier<String> messageSupplier)
    • logResultSetClosingFailure

      public void logResultSetClosingFailure(String callerClassName, String callerMethodName, SQLException e)
      Description copied from interface: JdbcLogger
      Logs a failure of a result set close.
      Specified by:
      logResultSetClosingFailure in interface JdbcLogger
      Parameters:
      callerClassName - the caller class name
      callerMethodName - the caller method name
      e - the cause of the failure
      See Also:
    • logResultSetClosingFailure

      protected void logResultSetClosingFailure(String callerClassName, String callerMethodName, SQLException e, LEVEL level, Supplier<String> messageSupplier)