CORDA-3060: Improve Notary logging from an operator/admins point of view

Added logging during the processing steps of the PersistentUniqunessProvider and the RaftUniquenessProvider
Bumped up logging level of existing logging statements that occur while processing from debug to info
Added mention of txId to logging statements to enable a request to be traced through from the time it is added to the queue to the time that it is committed.
This commit is contained in:
Jonathan Locke 2019-08-19 15:12:56 +01:00 committed by Andrius Dagys
parent c096dcab3b
commit 16e4650d8d
2 changed files with 9 additions and 7 deletions

View File

@ -181,6 +181,7 @@ class PersistentUniquenessProvider(val clock: Clock, val database: CordaPersiste
val future = openFuture<UniquenessProvider.Result>()
val request = CommitRequest(states, txId, callerIdentity, requestSignature, timeWindow, references, future)
requestQueue.put(request)
log.debug { "Request added to queue. txId: $txId" }
return future
}
@ -246,18 +247,18 @@ class PersistentUniquenessProvider(val clock: Clock, val database: CordaPersiste
private fun handleReferenceConflicts(txId: SecureHash, conflictingStates: LinkedHashMap<StateRef, StateConsumptionDetails>) {
if (!previouslyCommitted(txId)) {
val conflictError = NotaryError.Conflict(txId, conflictingStates)
log.debug { "Failure, input states already committed: ${conflictingStates.keys}" }
log.info("Failure, input states already committed: ${conflictingStates.keys}. txId: $txId")
throw NotaryInternalException(conflictError)
}
log.debug { "Transaction $txId already notarised" }
log.info("Transaction $txId already notarised. txId: $txId")
}
private fun handleConflicts(txId: SecureHash, conflictingStates: LinkedHashMap<StateRef, StateConsumptionDetails>) {
if (isConsumedByTheSameTx(txId.sha256(), conflictingStates)) {
log.debug { "Transaction $txId already notarised" }
log.info("Transaction $txId already notarised. txId: $txId")
return
} else {
log.debug { "Failure, input states already committed: ${conflictingStates.keys}" }
log.info("Failure, input states already committed: ${conflictingStates.keys}. txId: $txId")
val conflictError = NotaryError.Conflict(txId, conflictingStates)
throw NotaryInternalException(conflictError)
}
@ -276,7 +277,7 @@ class PersistentUniquenessProvider(val clock: Clock, val database: CordaPersiste
}
val session = currentDBSession()
session.persist(CommittedTransaction(txId.toString()))
log.debug { "Successfully committed all input states: $states" }
log.info("Successfully committed all input states: $states. txId: $txId")
} else {
throw NotaryInternalException(outsideTimeWindowError)
}

View File

@ -211,7 +211,7 @@ class RaftUniquenessProvider(
timeWindow: TimeWindow?,
references: List<StateRef>
): CordaFuture<UniquenessProvider.Result> {
log.debug { "Attempting to commit input states: ${states.joinToString()}" }
log.debug { "Attempting to commit input states: ${states.joinToString()} for txId: $txId" }
val commitCommand = CommitTransaction(
states,
txId,
@ -223,9 +223,10 @@ class RaftUniquenessProvider(
val future = openFuture<UniquenessProvider.Result>()
client.submit(commitCommand).thenAccept { commitError ->
val result = if (commitError != null) {
log.info("Error occurred while notarising $txId: $commitError")
UniquenessProvider.Result.Failure(commitError)
} else {
log.debug { "All input states of transaction $txId have been committed" }
log.info("All input states of transaction $txId have been committed")
UniquenessProvider.Result.Success
}
future.set(result)