Fixing exception logging for the HSM cert generator (#561)

This commit is contained in:
Michal Kit 2018-03-19 08:26:27 +00:00 committed by GitHub
parent fef30e49a8
commit a26c5c1483
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,7 +15,7 @@ import com.r3.corda.networkmanage.hsm.utils.mapCryptoServerException
import net.corda.nodeapi.internal.crypto.CertificateType.ROOT_CA import net.corda.nodeapi.internal.crypto.CertificateType.ROOT_CA
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
private val log = LogManager.getLogger("com.r3.corda.networkmanage.hsm.generator.Main") private val logger = LogManager.getLogger("com.r3.corda.networkmanage.hsm.generator.Main")
fun main(args: Array<String>) { fun main(args: Array<String>) {
run(parseParameters(parseCommandLine(*args)?.configFile)) run(parseParameters(parseCommandLine(*args)?.configFile))
@ -31,6 +31,7 @@ fun run(parameters: GeneratorParameters) {
try { try {
AutoAuthenticator(providerConfig, userConfigs).connectAndAuthenticate { provider -> AutoAuthenticator(providerConfig, userConfigs).connectAndAuthenticate { provider ->
val generator = KeyCertificateGenerator(this) val generator = KeyCertificateGenerator(this)
logger.info("Generating ${certConfig.certificateType.name} certificate.")
if (certConfig.certificateType == ROOT_CA) { if (certConfig.certificateType == ROOT_CA) {
generator.generate(provider) generator.generate(provider)
} else { } else {
@ -48,7 +49,7 @@ fun run(parameters: GeneratorParameters) {
provider.logoff() provider.logoff()
} }
} catch (e: Exception) { } catch (e: Exception) {
log.error(mapCryptoServerException(e)) logger.error("HSM certificate generation error.", mapCryptoServerException(e))
} }
} }
} }