Skip to content

Commit ab4c1c3

Browse files
added logging to diagnose issue (#524)
* added logging to diagnose issue * added logging to diagnose issue
1 parent d3347bf commit ab4c1c3

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/gateways/PrisonerOffenderSearchGateway.kt

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package uk.gov.justice.digital.hmpps.hmppsintegrationapi.gateways
22

3+
import org.slf4j.LoggerFactory
34
import org.springframework.beans.factory.annotation.Autowired
45
import org.springframework.beans.factory.annotation.Value
56
import org.springframework.http.HttpMethod
@@ -18,6 +19,8 @@ class PrisonerOffenderSearchGateway(
1819
) {
1920
private val webClient = WebClientWrapper(baseUrl)
2021

22+
private val log: org.slf4j.Logger = LoggerFactory.getLogger(this::class.java)
23+
2124
@Autowired
2225
lateinit var hmppsAuthGateway: HmppsAuthGateway
2326

@@ -56,6 +59,7 @@ class PrisonerOffenderSearchGateway(
5659
}
5760

5861
fun getPrisonOffender(nomsNumber: String): Response<POSPrisoner?> {
62+
log.info("looking up the person via prison search $nomsNumber")
5963
val result =
6064
webClient.request<POSPrisoner>(
6165
HttpMethod.GET,
@@ -66,10 +70,12 @@ class PrisonerOffenderSearchGateway(
6670

6771
return when (result) {
6872
is WebClientWrapperResponse.Success -> {
73+
log.info("found a match via prison search $nomsNumber")
6974
Response(data = result.data)
7075
}
7176

7277
is WebClientWrapperResponse.Error -> {
78+
log.error("An error occurred getting person from prion search: ${result.errors}")
7379
Response(
7480
data = null,
7581
errors = result.errors,

src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/services/GetHmppsIdService.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package uk.gov.justice.digital.hmpps.hmppsintegrationapi.services
22

3+
import org.slf4j.LoggerFactory
34
import org.springframework.beans.factory.annotation.Autowired
45
import org.springframework.stereotype.Service
56
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.HmppsId
@@ -10,14 +11,17 @@ import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.Response
1011
class GetHmppsIdService(
1112
@Autowired val getPersonService: GetPersonService,
1213
) {
14+
private val log: org.slf4j.Logger = LoggerFactory.getLogger(this::class.java)
15+
1316
fun execute(hmppsId: String): Response<HmppsId?> {
1417
val personResponse = getPersonService.execute(hmppsId.uppercase())
1518

1619
var hmppsIdToReturn =
1720
personResponse.data?.hmppsId
18-
21+
log.info("hmppsId from probation: $hmppsIdToReturn")
1922
if (hmppsIdToReturn == null) {
2023
hmppsIdToReturn = getPersonService.getPersonFromNomis(hmppsId.uppercase()).data?.prisonerNumber
24+
log.info("hmppsId from prison: $hmppsIdToReturn")
2125
}
2226

2327
return Response(

src/main/resources/application-dev.yml

+5
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,8 @@ authorisation:
114114
- "/v1/persons/.*/plp/inductionScheduleUpdated"
115115
- "/v1/hmpps/id/by-nomis-number/[^/]*$"
116116
- "/v1/hmpps/id/nomis-number/by-hmpps-id/[^/]*$"
117+
118+
logging:
119+
level:
120+
root: INFO
121+
uk.gov.justice.digital.hmpps.hmppsintegrationapi: DEBUG

0 commit comments

Comments
 (0)