Package org.apache.cayenne.log
Class NoopSQLLogger
java.lang.Object
org.apache.cayenne.log.NoopSQLLogger
- All Implemented Interfaces:
SQLLogger
A no-op
SQLLogger. Used as a null-object default in contexts that run without a configured logger, such as
schema-generation tools and tests. It always reports isEnabled() as false; to actually disable logging in a
running application, set the cayenne-sql log level instead.- Since:
- 5.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic NoopSQLLoggerbooleanReturns true if statement logging is enabled.voidlogAlsoSelect(int rowCount) Logs a select count continuation line for the statement whose header was already logged.voidlogAlsoUpdate(int rowCount) Logs an update count continuation line for the statement whose header was already logged.voidlogMessage(String message) Logs an arbitrary message, such as DDL, PK-generation SQL, or adapter-detection notes.voidlogQueryError(TranslatedStatement statement, Throwable error, long durationMillis) Logs, at the ERROR level, the statement that was in progress when a query exception occurred: SQL +bind:[...]+ the error message, followed by a trailingtime_ms:Nblock with the time elapsed until the failure.voidlogSelect(TranslatedStatement statement, int rowCount, long durationMillis) Logs the main line for a statement that returned a result set: SQL +bind:[...]+selected:N, followed by a trailingtime_ms:Nblock with the statement's execution time.voidLogs a transaction commit boundary (emitted at DEBUG level).voidLogs a transaction rollback boundary (emitted at DEBUG level).voidLogs a transaction start boundary (emitted at DEBUG level).voidlogUpdate(TranslatedStatement statement, int rowCount, List<? extends Map<String, ?>> generatedKeys, long durationMillis) Logs the main line for a statement that performed an update: SQL +bind:[...]+updated:N, optionally followed by agenerated:[...]block listing any database-generated keys, and a trailingtime_ms:Nblock with the statement's execution time.
-
Method Details
-
getInstance
-
isEnabled
public boolean isEnabled()Description copied from interface:SQLLoggerReturns true if statement logging is enabled. Callers should skip the work of assembling results when this returns false. -
logSelect
Description copied from interface:SQLLoggerLogs the main line for a statement that returned a result set: SQL +bind:[...]+selected:N, followed by a trailingtime_ms:Nblock with the statement's execution time. -
logUpdate
public void logUpdate(TranslatedStatement statement, int rowCount, List<? extends Map<String, ?>> generatedKeys, long durationMillis) Description copied from interface:SQLLoggerLogs the main line for a statement that performed an update: SQL +bind:[...]+updated:N, optionally followed by agenerated:[...]block listing any database-generated keys, and a trailingtime_ms:Nblock with the statement's execution time.- Specified by:
logUpdatein interfaceSQLLogger- Parameters:
statement- the translated statement carrying SQL and bindingsrowCount- the number of updated rowsgeneratedKeys- the database-generated keys of the inserted rows, or an empty list if nonedurationMillis- the statement's execution time in milliseconds
-
logQueryError
Description copied from interface:SQLLoggerLogs, at the ERROR level, the statement that was in progress when a query exception occurred: SQL +bind:[...]+ the error message, followed by a trailingtime_ms:Nblock with the time elapsed until the failure.- Specified by:
logQueryErrorin interfaceSQLLogger- Parameters:
statement- the translated statement carrying SQL and bindingserror- the exception thrown while executing the statementdurationMillis- the time in milliseconds elapsed until the failure
-
logAlsoSelect
public void logAlsoSelect(int rowCount) Description copied from interface:SQLLoggerLogs a select count continuation line for the statement whose header was already logged.- Specified by:
logAlsoSelectin interfaceSQLLogger
-
logAlsoUpdate
public void logAlsoUpdate(int rowCount) Description copied from interface:SQLLoggerLogs an update count continuation line for the statement whose header was already logged.- Specified by:
logAlsoUpdatein interfaceSQLLogger
-
logTransactionStart
public void logTransactionStart()Description copied from interface:SQLLoggerLogs a transaction start boundary (emitted at DEBUG level).- Specified by:
logTransactionStartin interfaceSQLLogger
-
logTransactionCommit
public void logTransactionCommit()Description copied from interface:SQLLoggerLogs a transaction commit boundary (emitted at DEBUG level).- Specified by:
logTransactionCommitin interfaceSQLLogger
-
logTransactionRollback
public void logTransactionRollback()Description copied from interface:SQLLoggerLogs a transaction rollback boundary (emitted at DEBUG level).- Specified by:
logTransactionRollbackin interfaceSQLLogger
-
logMessage
Description copied from interface:SQLLoggerLogs an arbitrary message, such as DDL, PK-generation SQL, or adapter-detection notes.- Specified by:
logMessagein interfaceSQLLogger
-