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
This commit is contained in:
Anthony Keenan
2018-11-06 22:15:22 +00:00
committed by GitHub
parent ac64b6c37c
commit 6fd724338a
2 changed files with 7 additions and 3 deletions

View File

@ -554,7 +554,11 @@ abstract class AbstractNode<S>(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)
}