Class TsurugiSessionTxLogger
- java.lang.Object
-
- com.tsurugidb.iceaxe.session.event.logging.TsurugiSessionTxLogger
-
- All Implemented Interfaces:
TsurugiSessionEventListener
- Direct Known Subclasses:
TsurugiSessionTxFileLogger
public class TsurugiSessionTxLogger extends java.lang.Object implements TsurugiSessionEventListener
Tsurugi transaction logger.
-
-
Constructor Summary
Constructors Constructor Description TsurugiSessionTxLogger()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeSession(TsurugiSession session, long timeoutNanos, java.lang.Throwable occurred)
called when close session.<P,R>
voidcreateQuery(TsurugiSqlPreparedQuery<P,R> ps)
called when create prepared query.<R> void
createQuery(TsurugiSqlQuery<R> ps)
called when create query.<P> void
createStatement(TsurugiSqlPreparedStatement<P> ps)
called when create prepared statement.void
createStatement(TsurugiSqlStatement ps)
called when create statement.protected TgSessionTmLog
createTmLog()
Creates a new transaction manager execute log.void
createTransaction(TsurugiTransaction transaction)
called when create transaction.void
createTransactionManager(TsurugiTransactionManager tm)
called when create transaction manager.protected TgSessionTxLog
createTxLog()
Creates a new transaction log instance.protected void
doLogSqlClose(TsurugiTransaction transaction, TsurugiSqlResult result, java.lang.Throwable occurred)
do SQL result close.protected void
doLogSqlEnd(TsurugiTransaction transaction, TsurugiSqlResult result, java.lang.Throwable occurred)
do SQL execute end.protected <R> void
doLogSqlRead(TsurugiTransaction transaction, TsurugiQueryResult<R> result, R record)
do SQL read.protected <R> void
doLogSqlReadException(TsurugiTransaction transaction, TsurugiQueryResult<R> result, java.lang.Throwable occurred)
do SQL read error.protected void
doLogSqlStart(TsurugiTransaction transaction, int iceaxeSqlExecuteId, TsurugiSql ps, java.lang.Object parameter)
do SQL start.protected void
doLogSqlStarted(TsurugiTransaction transaction, TsurugiSqlResult result)
do SQL execute started.protected void
doLogSqlStartException(TsurugiTransaction transaction, int iceaxeSqlExecuteId, java.lang.Throwable occurred)
do SQL execute start error.protected void
doLogTmExecuteEnd(int iceaxeTmExecuteId, TsurugiTransaction transaction, boolean committed, java.lang.Object returnValue, java.lang.Throwable occurred)
do transactionManager execute end.protected void
doLogTmExecuteException(TsurugiTransaction transaction, java.lang.Throwable occurred)
do transactionManager execute error.protected void
doLogTmExecuteRetry(TsurugiTransaction transaction, java.lang.Exception cause, TgTmTxOption nextTmOption)
do transactionManager execute retry.protected void
doLogTmExecuteStart(int iceaxeTmExecuteId)
do transactionManager execute start.protected void
doLogTransactionClose(TsurugiTransaction transaction, java.lang.Throwable occurred)
do transaction close.protected void
doLogTransactionCommitEnd(TsurugiTransaction transaction, TgCommitType commitType, java.lang.Throwable occurred)
do commit end.protected void
doLogTransactionCommitStart(TsurugiTransaction transaction, TgCommitType commitType)
do commit start.protected void
doLogTransactionRollbackEnd(TsurugiTransaction transaction, java.lang.Throwable occurred)
do rollback end.protected void
doLogTransactionRollbackStart(TsurugiTransaction transaction)
do rollback start.protected void
doLogTransactionSqlEnd(TsurugiTransaction transaction, TsurugiTransaction.TgTxMethod method, int iceaxeTxExecuteId, TsurugiSql ps, java.lang.Object parameter, TsurugiSqlResult result, java.lang.Throwable occurred)
do execute SQL end.protected void
doLogTransactionSqlStart(TsurugiTransaction transaction, TsurugiTransaction.TgTxMethod method, int iceaxeTxExecuteId, TsurugiSql ps, java.lang.Object parameter)
do execute SQL start.protected void
doLogTransactionStart(TsurugiTransaction transaction, java.time.ZonedDateTime startTime)
do transaction start.protected void
doLowTransactionGetEnd(TsurugiTransaction transaction, java.lang.String transactionId, java.lang.Throwable occurred)
do get transactionId.protected void
doLowTransactionGetStart(TsurugiTransaction transaction)
do get transactionId.protected TgSessionTmLog
getTmLog(int iceaxeTmExecuteId)
get transaction manager execute log.protected TgSessionTxLog
getTxLog(TsurugiTransaction transaction)
get transaction log.protected void
logCreateSqlStatement(TsurugiSql ps)
called when create SQL definition.protected void
logLowTransactionGetEnd(TgSessionTxLog txLog, java.lang.String transactionId, java.lang.Throwable occurred)
called when get transactionId.protected void
logLowTransactionGetStart(TgSessionTxLog txLog)
called when get transactionId.protected void
logSessionClose(TsurugiSession session, java.lang.Throwable occurred)
called when close session.protected void
logSessionShutdown(TsurugiSession session, TgSessionShutdownType shutdownType, java.lang.Throwable occurred)
called when shutdown session.protected void
logSqlClose(TgSessionTxLog txLog, TgSessionSqlLog sqlLog, java.lang.Throwable occurred)
called when SQL result close.protected void
logSqlEnd(TgSessionTxLog txLog, TgSessionSqlLog sqlLog, java.lang.Throwable occurred)
called when SQL execute end.protected <R> void
logSqlRead(TgSessionTxLog txLog, TgSessionSqlLog sqlLog, TsurugiQueryResult<R> result, R record)
called when SQL read.protected <R> void
logSqlReadException(TgSessionTxLog txLog, TgSessionSqlLog sqlLog, TsurugiQueryResult<R> result, java.lang.Throwable occurred)
called when occurs exception SQL read.protected void
logSqlStart(TgSessionTxLog txLog, TgSessionSqlLog sqlLog)
called when SQL execute start.protected void
logSqlStarted(TgSessionTxLog txLog, TgSessionSqlLog sqlLog)
called when SQL execute started.protected void
logSqlStartException(TgSessionTxLog txLog, TgSessionSqlLog sqlLog, java.lang.Throwable occurred)
called when occurs exception SQL execute start.protected void
logTmExecuteEnd(TgSessionTmLog tmLog, java.lang.Throwable occurred)
called when transactionManager execute end.protected void
logTmExecuteException(TgSessionTxLog txLog, java.lang.Throwable occurred)
called when occurs transactionManager execute error.protected void
logTmExecuteRetry(TgSessionTxLog txLog, java.lang.Exception cause, TgTmTxOption nextTmOption)
called when transactionManager execute retry.protected void
logTmExecuteStart(TgSessionTmLog tmLog)
called when transactionManager execute start.protected void
logTransactionClose(TgSessionTxLog txLog, java.lang.Throwable occurred)
called when transaction close.protected void
logTransactionCommitEnd(TgSessionTxLog txLog, TgCommitType commitType, java.lang.Throwable occurred)
called when commit end.protected void
logTransactionCommitStart(TgSessionTxLog txLog, TgCommitType commitType)
called when commit start.protected void
logTransactionRollbackEnd(TgSessionTxLog txLog, java.lang.Throwable occurred)
called when rollback end.protected void
logTransactionRollbackStart(TgSessionTxLog txLog)
called when rollback start.protected void
logTransactionSqlEnd(TsurugiTransaction.TgTxMethod method, TgSessionTxLog txLog, TgSessionTxLog.TgSessionTxExecuteLog exLog, TsurugiSql ps, java.lang.Object parameter, TsurugiSqlResult result, java.lang.Throwable occurred)
called when execute SQL end.protected void
logTransactionSqlStart(TsurugiTransaction.TgTxMethod method, TgSessionTxLog txLog, TgSessionTxLog.TgSessionTxExecuteLog exLog, TsurugiSql ps, java.lang.Object parameter)
called when execute SQL start.protected void
logTransactionStart(TgSessionTxLog txLog)
called when transaction start.void
shutdownSession(TsurugiSession session, TgSessionShutdownType shutdownType, long timeoutNanos, java.lang.Throwable occurred)
called when shutdown session.
-
-
-
Method Detail
-
createQuery
public final <R> void createQuery(TsurugiSqlQuery<R> ps)
Description copied from interface:TsurugiSessionEventListener
called when create query.- Specified by:
createQuery
in interfaceTsurugiSessionEventListener
- Type Parameters:
R
- result type- Parameters:
ps
- query
-
createQuery
public final <P,R> void createQuery(TsurugiSqlPreparedQuery<P,R> ps)
Description copied from interface:TsurugiSessionEventListener
called when create prepared query.- Specified by:
createQuery
in interfaceTsurugiSessionEventListener
- Type Parameters:
P
- parameter typeR
- result type- Parameters:
ps
- query
-
createStatement
public final void createStatement(TsurugiSqlStatement ps)
Description copied from interface:TsurugiSessionEventListener
called when create statement.- Specified by:
createStatement
in interfaceTsurugiSessionEventListener
- Parameters:
ps
- statement
-
createStatement
public final <P> void createStatement(TsurugiSqlPreparedStatement<P> ps)
Description copied from interface:TsurugiSessionEventListener
called when create prepared statement.- Specified by:
createStatement
in interfaceTsurugiSessionEventListener
- Type Parameters:
P
- parameter type- Parameters:
ps
- statement
-
createTransactionManager
public final void createTransactionManager(TsurugiTransactionManager tm)
Description copied from interface:TsurugiSessionEventListener
called when create transaction manager.- Specified by:
createTransactionManager
in interfaceTsurugiSessionEventListener
- Parameters:
tm
- transaction manager
-
createTransaction
public final void createTransaction(TsurugiTransaction transaction)
Description copied from interface:TsurugiSessionEventListener
called when create transaction.- Specified by:
createTransaction
in interfaceTsurugiSessionEventListener
- Parameters:
transaction
- transaction
-
shutdownSession
public final void shutdownSession(TsurugiSession session, TgSessionShutdownType shutdownType, long timeoutNanos, @Nullable java.lang.Throwable occurred)
Description copied from interface:TsurugiSessionEventListener
called when shutdown session.- Specified by:
shutdownSession
in interfaceTsurugiSessionEventListener
- Parameters:
session
- sessionshutdownType
- shutdown typetimeoutNanos
- shutdown timeoutoccurred
- exception
-
closeSession
public final void closeSession(TsurugiSession session, long timeoutNanos, @Nullable java.lang.Throwable occurred)
Description copied from interface:TsurugiSessionEventListener
called when close session.- Specified by:
closeSession
in interfaceTsurugiSessionEventListener
- Parameters:
session
- sessiontimeoutNanos
- close timeoutoccurred
- exception
-
logCreateSqlStatement
protected void logCreateSqlStatement(TsurugiSql ps)
called when create SQL definition.- Parameters:
ps
- SQL definition
-
logSessionShutdown
protected void logSessionShutdown(TsurugiSession session, TgSessionShutdownType shutdownType, @Nullable java.lang.Throwable occurred)
called when shutdown session.- Parameters:
session
- sessionshutdownType
- shutdown typeoccurred
- exception- Since:
- 1.4.0
-
logSessionClose
protected void logSessionClose(TsurugiSession session, @Nullable java.lang.Throwable occurred)
called when close session.- Parameters:
session
- sessionoccurred
- exception
-
doLogTmExecuteStart
protected void doLogTmExecuteStart(int iceaxeTmExecuteId)
do transactionManager execute start.- Parameters:
iceaxeTmExecuteId
- iceaxe tm executeId
-
createTmLog
protected TgSessionTmLog createTmLog()
Creates a new transaction manager execute log.- Returns:
- transaction manager execute log
-
getTmLog
protected TgSessionTmLog getTmLog(int iceaxeTmExecuteId)
get transaction manager execute log.- Parameters:
iceaxeTmExecuteId
- iceaxe tm executeId- Returns:
- transaction manager execute log
-
logTmExecuteStart
protected void logTmExecuteStart(TgSessionTmLog tmLog)
called when transactionManager execute start.- Parameters:
tmLog
- transaction manager log
-
doLogTmExecuteException
protected void doLogTmExecuteException(TsurugiTransaction transaction, java.lang.Throwable occurred)
do transactionManager execute error.- Parameters:
transaction
- transactionoccurred
- exception
-
logTmExecuteException
protected void logTmExecuteException(TgSessionTxLog txLog, java.lang.Throwable occurred)
called when occurs transactionManager execute error.- Parameters:
txLog
- transaction logoccurred
- exception
-
doLogTmExecuteRetry
protected void doLogTmExecuteRetry(TsurugiTransaction transaction, java.lang.Exception cause, TgTmTxOption nextTmOption)
do transactionManager execute retry.- Parameters:
transaction
- transactioncause
- retry exceptionnextTmOption
- next transaction option
-
logTmExecuteRetry
protected void logTmExecuteRetry(TgSessionTxLog txLog, java.lang.Exception cause, TgTmTxOption nextTmOption)
called when transactionManager execute retry.- Parameters:
txLog
- transaction logcause
- retry exceptionnextTmOption
- next transaction option
-
doLogTmExecuteEnd
protected void doLogTmExecuteEnd(int iceaxeTmExecuteId, @Nullable TsurugiTransaction transaction, boolean committed, @Nullable java.lang.Object returnValue, @Nullable java.lang.Throwable occurred)
do transactionManager execute end.- Parameters:
iceaxeTmExecuteId
- iceaxe tm executeIdtransaction
- transactioncommitted
-true
if committedreturnValue
- return valueoccurred
- exception
-
logTmExecuteEnd
protected void logTmExecuteEnd(TgSessionTmLog tmLog, @Nullable java.lang.Throwable occurred)
called when transactionManager execute end.- Parameters:
tmLog
- transaction manager logoccurred
- exception
-
doLogTransactionStart
protected void doLogTransactionStart(TsurugiTransaction transaction, java.time.ZonedDateTime startTime)
do transaction start.- Parameters:
transaction
- transactionstartTime
- start time
-
createTxLog
protected TgSessionTxLog createTxLog()
Creates a new transaction log instance.- Returns:
- transaction log
-
getTxLog
protected TgSessionTxLog getTxLog(TsurugiTransaction transaction)
get transaction log.- Parameters:
transaction
- transaction- Returns:
- transaction log
-
logTransactionStart
protected void logTransactionStart(TgSessionTxLog txLog)
called when transaction start.- Parameters:
txLog
- transaction log
-
doLowTransactionGetStart
protected void doLowTransactionGetStart(TsurugiTransaction transaction)
do get transactionId.- Parameters:
transaction
- transaction
-
logLowTransactionGetStart
protected void logLowTransactionGetStart(TgSessionTxLog txLog)
called when get transactionId.- Parameters:
txLog
- transaction log
-
doLowTransactionGetEnd
protected void doLowTransactionGetEnd(TsurugiTransaction transaction, java.lang.String transactionId, java.lang.Throwable occurred)
do get transactionId.- Parameters:
transaction
- transactiontransactionId
- transaction idoccurred
- exception
-
logLowTransactionGetEnd
protected void logLowTransactionGetEnd(TgSessionTxLog txLog, @Nullable java.lang.String transactionId, @Nullable java.lang.Throwable occurred)
called when get transactionId.- Parameters:
txLog
- transaction logtransactionId
- transactionIdoccurred
- exception
-
doLogTransactionSqlStart
protected void doLogTransactionSqlStart(TsurugiTransaction transaction, TsurugiTransaction.TgTxMethod method, int iceaxeTxExecuteId, TsurugiSql ps, java.lang.Object parameter)
do execute SQL start.- Parameters:
transaction
- transactionmethod
- execute methodiceaxeTxExecuteId
- iceaxe tm executeIdps
- SQL definitionparameter
- SQL parameter
-
logTransactionSqlStart
protected void logTransactionSqlStart(TsurugiTransaction.TgTxMethod method, TgSessionTxLog txLog, TgSessionTxLog.TgSessionTxExecuteLog exLog, TsurugiSql ps, java.lang.Object parameter)
called when execute SQL start.- Parameters:
method
- execute methodtxLog
- transaction logexLog
- transaction SQL execute logps
- SQL definitionparameter
- SQL parameter
-
doLogTransactionSqlEnd
protected void doLogTransactionSqlEnd(TsurugiTransaction transaction, TsurugiTransaction.TgTxMethod method, int iceaxeTxExecuteId, TsurugiSql ps, java.lang.Object parameter, @Nullable TsurugiSqlResult result, @Nullable java.lang.Throwable occurred)
do execute SQL end.- Parameters:
transaction
- transactionmethod
- execute methodiceaxeTxExecuteId
- iceaxe tm executeIdps
- SQL definitionparameter
- SQL parameterresult
- SQL resultoccurred
- exception
-
logTransactionSqlEnd
protected void logTransactionSqlEnd(TsurugiTransaction.TgTxMethod method, TgSessionTxLog txLog, TgSessionTxLog.TgSessionTxExecuteLog exLog, TsurugiSql ps, java.lang.Object parameter, @Nullable TsurugiSqlResult result, @Nullable java.lang.Throwable occurred)
called when execute SQL end.- Parameters:
method
- execute methodtxLog
- transaction logexLog
- transaction SQL execute logps
- SQL definitionparameter
- SQL parameterresult
- SQL resultoccurred
- exception
-
doLogTransactionCommitStart
protected void doLogTransactionCommitStart(TsurugiTransaction transaction, TgCommitType commitType)
do commit start.- Parameters:
transaction
- transactioncommitType
- commit type
-
logTransactionCommitStart
protected void logTransactionCommitStart(TgSessionTxLog txLog, TgCommitType commitType)
called when commit start.- Parameters:
txLog
- transaction logcommitType
- commit type
-
doLogTransactionCommitEnd
protected void doLogTransactionCommitEnd(TsurugiTransaction transaction, TgCommitType commitType, @Nullable java.lang.Throwable occurred)
do commit end.- Parameters:
transaction
- transactioncommitType
- commit typeoccurred
- exception
-
logTransactionCommitEnd
protected void logTransactionCommitEnd(TgSessionTxLog txLog, TgCommitType commitType, @Nullable java.lang.Throwable occurred)
called when commit end.- Parameters:
txLog
- transaction logcommitType
- commit typeoccurred
- exception
-
doLogTransactionRollbackStart
protected void doLogTransactionRollbackStart(TsurugiTransaction transaction)
do rollback start.- Parameters:
transaction
- transaction
-
logTransactionRollbackStart
protected void logTransactionRollbackStart(TgSessionTxLog txLog)
called when rollback start.- Parameters:
txLog
- transaction log
-
doLogTransactionRollbackEnd
protected void doLogTransactionRollbackEnd(TsurugiTransaction transaction, @Nullable java.lang.Throwable occurred)
do rollback end.- Parameters:
transaction
- transactionoccurred
- exception
-
logTransactionRollbackEnd
protected void logTransactionRollbackEnd(TgSessionTxLog txLog, @Nullable java.lang.Throwable occurred)
called when rollback end.- Parameters:
txLog
- transaction logoccurred
- exception
-
doLogTransactionClose
protected void doLogTransactionClose(TsurugiTransaction transaction, @Nullable java.lang.Throwable occurred)
do transaction close.- Parameters:
transaction
- transactionoccurred
- exception
-
logTransactionClose
protected void logTransactionClose(TgSessionTxLog txLog, @Nullable java.lang.Throwable occurred)
called when transaction close.- Parameters:
txLog
- transaction logoccurred
- exception
-
doLogSqlStart
protected void doLogSqlStart(TsurugiTransaction transaction, int iceaxeSqlExecuteId, TsurugiSql ps, java.lang.Object parameter)
do SQL start.- Parameters:
transaction
- transactioniceaxeSqlExecuteId
- iceaxe SQL executeIdps
- SQL definitionparameter
- SQL parameter
-
logSqlStart
protected void logSqlStart(TgSessionTxLog txLog, TgSessionSqlLog sqlLog)
called when SQL execute start.- Parameters:
txLog
- transaction logsqlLog
- SQL log
-
doLogSqlStartException
protected void doLogSqlStartException(TsurugiTransaction transaction, int iceaxeSqlExecuteId, java.lang.Throwable occurred)
do SQL execute start error.- Parameters:
transaction
- transactioniceaxeSqlExecuteId
- iceaxe SQL executeIdoccurred
- exception
-
logSqlStartException
protected void logSqlStartException(TgSessionTxLog txLog, TgSessionSqlLog sqlLog, java.lang.Throwable occurred)
called when occurs exception SQL execute start.- Parameters:
txLog
- transaction logsqlLog
- SQL logoccurred
- exception
-
doLogSqlStarted
protected void doLogSqlStarted(TsurugiTransaction transaction, TsurugiSqlResult result)
do SQL execute started.- Parameters:
transaction
- transactionresult
- SQL result
-
logSqlStarted
protected void logSqlStarted(TgSessionTxLog txLog, TgSessionSqlLog sqlLog)
called when SQL execute started.- Parameters:
txLog
- transaction logsqlLog
- SQL log
-
doLogSqlRead
protected <R> void doLogSqlRead(TsurugiTransaction transaction, TsurugiQueryResult<R> result, R record)
do SQL read.- Type Parameters:
R
- record type- Parameters:
transaction
- transactionresult
- SQL resultrecord
- record
-
logSqlRead
protected <R> void logSqlRead(TgSessionTxLog txLog, TgSessionSqlLog sqlLog, TsurugiQueryResult<R> result, R record)
called when SQL read.- Type Parameters:
R
- result type- Parameters:
txLog
- transaction logsqlLog
- SQL logresult
- SQL resultrecord
- record
-
doLogSqlReadException
protected <R> void doLogSqlReadException(TsurugiTransaction transaction, TsurugiQueryResult<R> result, java.lang.Throwable occurred)
do SQL read error.- Type Parameters:
R
- record type- Parameters:
transaction
- transactionresult
- SQL resultoccurred
- exception
-
logSqlReadException
protected <R> void logSqlReadException(TgSessionTxLog txLog, TgSessionSqlLog sqlLog, TsurugiQueryResult<R> result, java.lang.Throwable occurred)
called when occurs exception SQL read.- Type Parameters:
R
- record type- Parameters:
txLog
- transaction logsqlLog
- SQL logresult
- SQL resultoccurred
- exception
-
doLogSqlEnd
protected void doLogSqlEnd(TsurugiTransaction transaction, TsurugiSqlResult result, @Nullable java.lang.Throwable occurred)
do SQL execute end.- Parameters:
transaction
- transactionresult
- SQL resultoccurred
- exception
-
logSqlEnd
protected void logSqlEnd(TgSessionTxLog txLog, TgSessionSqlLog sqlLog, @Nullable java.lang.Throwable occurred)
called when SQL execute end.- Parameters:
txLog
- transaction logsqlLog
- SQL logoccurred
- exception
-
doLogSqlClose
protected void doLogSqlClose(TsurugiTransaction transaction, TsurugiSqlResult result, @Nullable java.lang.Throwable occurred)
do SQL result close.- Parameters:
transaction
- transactionresult
- SQL resultoccurred
- exception
-
logSqlClose
protected void logSqlClose(TgSessionTxLog txLog, TgSessionSqlLog sqlLog, @Nullable java.lang.Throwable occurred)
called when SQL result close.- Parameters:
txLog
- transaction logsqlLog
- SQL logoccurred
- exception
-
-