mirror of
https://github.com/corda/corda.git
synced 2025-01-31 00:24:59 +00:00
Minor: make the trace logging for the RPC server a bit more helpful.
This commit is contained in:
parent
785bae9e48
commit
409b4e2a42
@ -305,7 +305,18 @@ class RPCServer(
|
||||
private fun clientArtemisMessageHandler(artemisMessage: ClientMessage) {
|
||||
lifeCycle.requireState(State.STARTED)
|
||||
val clientToServer = RPCApi.ClientToServer.fromClientMessage(artemisMessage)
|
||||
log.debug { "-> RPC -> $clientToServer" }
|
||||
if (log.isDebugEnabled) {
|
||||
when (clientToServer) {
|
||||
is RPCApi.ClientToServer.RpcRequest -> {
|
||||
val username = artemisMessage.getStringProperty("_AMQ_VALIDATED_USER") ?: "(unknown)"
|
||||
// Don't print the whole object because most of the data is useless.
|
||||
log.debug { "-> RPC by $username -> ${clientToServer.methodName}" }
|
||||
}
|
||||
is RPCApi.ClientToServer.ObservablesClosed -> {
|
||||
log.debug { "-> RPC observable closed -> $clientToServer"}
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
when (clientToServer) {
|
||||
is RPCApi.ClientToServer.RpcRequest -> {
|
||||
@ -349,12 +360,15 @@ class RPCServer(
|
||||
return Try.on {
|
||||
try {
|
||||
CURRENT_RPC_CONTEXT.set(context)
|
||||
log.debug { "Calling $methodName" }
|
||||
log.trace { "Calling $methodName" }
|
||||
val method = methodTable[methodName] ?:
|
||||
throw RPCException("Received RPC for unknown method $methodName - possible client/server version skew?")
|
||||
method.invoke(ops, *arguments.toTypedArray())
|
||||
} catch (e: InvocationTargetException) {
|
||||
throw e.cause ?: RPCException("Caught InvocationTargetException without cause")
|
||||
} catch (e: Exception) {
|
||||
log.warn("Caught exception attempting to invoke RPC $methodName", e)
|
||||
throw e
|
||||
} finally {
|
||||
CURRENT_RPC_CONTEXT.remove()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user