Skip to content

Commit

Permalink
Lagt til loggableHeaders til feillogging #2
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksandrChmyrNAV committed Jan 10, 2025
1 parent 917ca8f commit 4d47611
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions ebms-provider/src/main/kotlin/no/nav/emottak/ebms/Routes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -345,21 +345,14 @@ fun saveEbmsMessageDetails(
repository: EbmsMessageRepository
) {
val ebmsMessageDetails = ebMSDocument.transform().toEbmsMessageDetails()
val markers = ebMSDocument.messageHeader().marker(loggableHeaders)
try {
repository.saveEbmsMessageDetails(ebmsMessageDetails)
log.info(ebMSDocument.messageHeader().marker(loggableHeaders), "Message details saved to database")
log.info(markers, "Message details saved to database")
} catch (ex: SQLException) {
val hint = repository.handleSQLException(ex)
log.error(
ebMSDocument.messageHeader().marker(loggableHeaders),
"SQL exception ${ex.sqlState} occurred while saving message details to database: $hint",
ex
)
log.error(markers, "SQL exception ${ex.sqlState} occurred while saving message details to database: $hint", ex)
} catch (ex: Exception) {
log.error(
ebMSDocument.messageHeader().marker(loggableHeaders),
"Error occurred while saving message details to database",
ex
)
log.error(markers, "Error occurred while saving message details to database", ex)
}
}

0 comments on commit 4d47611

Please sign in to comment.