From 6fd724338a3b8da977354982fda010ffa8d297ec Mon Sep 17 00:00:00 2001 From: Anthony Keenan Date: Tue, 6 Nov 2018 22:15:22 +0000 Subject: [PATCH] CORDA-2183: Show root cause of error in console to aid with debugging (#4178) * Show root cause of error in console * Add more explicit logical separator between message and root error * Add default if e.cause is null --- config/dev/log4j2.xml | 4 ++-- .../src/main/kotlin/net/corda/node/internal/AbstractNode.kt | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config/dev/log4j2.xml b/config/dev/log4j2.xml index bb2bdbeb70..408d9574d5 100644 --- a/config/dev/log4j2.xml +++ b/config/dev/log4j2.xml @@ -12,7 +12,7 @@ - + - + diff --git a/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt b/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt index 78d6e985ee..c60904c6a1 100644 --- a/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt +++ b/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt @@ -554,7 +554,11 @@ abstract class AbstractNode(val configuration: NodeConfiguration, log.error("${it.name}, as a Corda service, must have a constructor with a single parameter of type " + ServiceHub::class.java.name) } catch (e: ServiceInstantiationException) { - log.error("Corda service ${it.name} failed to instantiate", e.cause) + if (e.cause != null) { + log.error("Corda service ${it.name} failed to instantiate. Reason was: ${e.cause?.rootMessage}", e.cause) + } else { + log.error("Corda service ${it.name} failed to instantiate", e) + } } catch (e: Exception) { log.error("Unable to install Corda service ${it.name}", e) }