Skip to content

Commit

Permalink
more logging when getting tss id
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasDev committed Oct 25, 2023
1 parent 502f8d8 commit 15817ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ import no.nav.syfo.vedlegg.model.BehandlerInfo
import org.apache.kafka.clients.producer.KafkaProducer
import org.slf4j.LoggerFactory
import org.xml.sax.InputSource

private val sikkerlogg = LoggerFactory.getLogger("securelog")
val sikkerlogg = LoggerFactory.getLogger("securelog")

class BlockingApplicationRunner(
private val env: EnvironmentVariables,
Expand Down
9 changes: 8 additions & 1 deletion src/main/kotlin/no/nav/syfo/client/SmtssClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ import io.ktor.client.call.body
import io.ktor.client.request.accept
import io.ktor.client.request.get
import io.ktor.client.request.header
import io.ktor.client.statement.bodyAsText
import io.ktor.client.statement.readText
import io.ktor.http.ContentType
import io.ktor.http.HttpStatusCode
import io.ktor.http.contentType
import io.ktor.util.InternalAPI
import net.logstash.logback.argument.StructuredArguments
import no.nav.syfo.application.sikkerlogg
import no.nav.syfo.logger
import no.nav.syfo.util.LoggingMeta

Expand All @@ -25,6 +29,8 @@ class SmtssClient(
sykmeldingId: String,
): String? {
val accessToken = accessTokenClientV2.getAccessTokenV2(resourceId)

sikkerlogg.info("Henter TSS-id fra smtss sykmeldingId: $sykmeldingId, samhandlerFnr: $samhandlerFnr, samhandlerOrgName: $samhandlerOrgName")
val httpResponse =
httpClient.get("$endpointUrl/api/v1/samhandler/emottak") {
accept(ContentType.Application.Json)
Expand Down Expand Up @@ -55,6 +61,7 @@ class SmtssClient(
return getResponse(httpResponse, loggingMeta)
}

@OptIn(InternalAPI::class)
private suspend fun getResponse(
httpResponse: io.ktor.client.statement.HttpResponse,
loggingMeta: LoggingMeta
Expand All @@ -72,7 +79,7 @@ class SmtssClient(
null
}
else -> {
logger.error("Error getting TSS-id ${httpResponse.status}")
logger.error("Error getting TSS-id ${httpResponse.status} : ${httpResponse.bodyAsText()}")
throw RuntimeException("Error getting TSS-id")
}
}
Expand Down

0 comments on commit 15817ae

Please sign in to comment.