From 59d90efd8eb0d261feffacdaf2e5a097efd7b67c Mon Sep 17 00:00:00 2001 From: Viacheslav Date: Mon, 6 May 2024 13:46:41 -0700 Subject: [PATCH] Print exceptions in the status logs --- .../integration/server/Server.kt | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/cloud/infrastructure/integration-tools/src/main/kotlin/org/corfudb/cloud/infrastructure/integration/server/Server.kt b/cloud/infrastructure/integration-tools/src/main/kotlin/org/corfudb/cloud/infrastructure/integration/server/Server.kt index 97b25c03..2ab217d9 100644 --- a/cloud/infrastructure/integration-tools/src/main/kotlin/org/corfudb/cloud/infrastructure/integration/server/Server.kt +++ b/cloud/infrastructure/integration-tools/src/main/kotlin/org/corfudb/cloud/infrastructure/integration/server/Server.kt @@ -3,25 +3,15 @@ package org.corfudb.cloud.infrastructure.integration.server import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.github.ajalt.clikt.core.CliktCommand -import io.ktor.application.Application -import io.ktor.application.ApplicationStopped -import io.ktor.application.call -import io.ktor.application.install -import io.ktor.features.ContentNegotiation -import io.ktor.features.StatusPages -import io.ktor.http.HttpStatusCode -import io.ktor.http.content.resources -import io.ktor.http.content.static -import io.ktor.jackson.jackson -import io.ktor.request.receive -import io.ktor.response.respond -import io.ktor.routing.get -import io.ktor.routing.post -import io.ktor.routing.routing -import io.ktor.util.KtorExperimentalAPI -import java.io.File -import java.io.PrintWriter -import java.io.StringWriter +import io.ktor.application.* +import io.ktor.features.* +import io.ktor.http.* +import io.ktor.http.content.* +import io.ktor.jackson.* +import io.ktor.request.* +import io.ktor.response.* +import io.ktor.routing.* +import io.ktor.util.* import kotlinx.coroutines.async import org.corfudb.cloud.infrastructure.integration.ArchiveConfig import org.corfudb.cloud.infrastructure.integration.IntegrationToolConfig @@ -29,6 +19,9 @@ import org.corfudb.cloud.infrastructure.integration.kv.KvStore import org.corfudb.cloud.infrastructure.integration.kv.ProcessingMessage import org.corfudb.cloud.infrastructure.integration.kv.RocksDbManager import org.corfudb.cloud.infrastructure.integration.processing.ProcessingManager +import java.io.File +import java.io.PrintWriter +import java.io.StringWriter @KtorExperimentalAPI @kotlin.jvm.JvmOverloads @@ -107,7 +100,12 @@ fun Application.module(testing: Boolean = false) { try { ProcessingManager(kvStore, request.aggregationUnit, config).execute() } catch (ex: Exception) { - kvStore.put(ProcessingMessage.new(request.aggregationUnit, "Processing error")) + val sw = StringWriter() + val pw = PrintWriter(sw) + ex.printStackTrace(pw) + val sStackTrace = sw.toString() + val errStr = "Processing error: $sStackTrace" + kvStore.put(ProcessingMessage.new(request.aggregationUnit, errStr)) } }