From 217f3115186b98f2d09cbed018a0fed9c94e3ace Mon Sep 17 00:00:00 2001 From: alexsilva Date: Mon, 20 Nov 2023 14:42:36 +0000 Subject: [PATCH] refactor(bpdm) - Added DEBUG type logs on Pool, Gate and Orchestrator Services and added logging and logging patterns on application yml's --- .../src/main/resources/application.yml | 15 ++++-- .../src/main/resources/application.yml | 39 +++++++++----- .../gate/service/BusinessPartnerService.kt | 6 +++ .../bpdm/gate/service/ChangelogService.kt | 5 ++ .../bpdm/gate/service/DocumentationService.kt | 5 +- .../bpdm/gate/service/SharingStateService.kt | 6 +++ .../src/main/resources/application-auth.yml | 1 + bpdm-gate/src/main/resources/application.yml | 17 ++++-- .../service/GoldenRecordTaskService.kt | 4 ++ .../service/GoldenRecordTaskStateMachine.kt | 7 +++ .../src/main/resources/application-auth.yml | 1 + .../src/main/resources/application.yml | 13 +++++ .../bpdm/pool/service/AddressService.kt | 9 ++++ .../service/BusinessPartnerFetchService.kt | 8 +++ .../tractusx/bpdm/pool/service/SiteService.kt | 6 +++ bpdm-pool/src/main/resources/application.yml | 17 ++++-- .../src/main/resources/logback-spring.xml | 52 ------------------- 17 files changed, 134 insertions(+), 77 deletions(-) delete mode 100644 bpdm-pool/src/main/resources/logback-spring.xml diff --git a/bpdm-bridge-dummy/src/main/resources/application.yml b/bpdm-bridge-dummy/src/main/resources/application.yml index de067872c..ae9de46b1 100644 --- a/bpdm-bridge-dummy/src/main/resources/application.yml +++ b/bpdm-bridge-dummy/src/main/resources/application.yml @@ -23,9 +23,18 @@ bpdm: host: localhost schema: bpdm-bridge-dummy - # Logging Configuration - logging: - unknown-user: Anonymous +# Logging Configuration +logging: + unknown-user: Anonymous + pattern: + console: "%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) %green([%-10.10X{user:-System}]) %magenta([%-10.10X{request:-No Request}]) %yellow([%-15.15t]) %cyan(%-40.40logger{39}) : %m%n%wEx" + level: + root: INFO + com: + catenax: + bpdm: + bridge: + dummy: DEBUG #Enable actuator endpoints management: diff --git a/bpdm-cleaning-service-dummy/src/main/resources/application.yml b/bpdm-cleaning-service-dummy/src/main/resources/application.yml index 304b962da..fb6467f0f 100644 --- a/bpdm-cleaning-service-dummy/src/main/resources/application.yml +++ b/bpdm-cleaning-service-dummy/src/main/resources/application.yml @@ -29,27 +29,40 @@ bpdm: # Connection to Orchestrator client: orchestrator: - base-url: http://localhost:8085/ + base-url: http://localhost:8085/ - # Logging Configuration + # Logging Configuration logging: - unknown-user: Anonymous + unknown-user: Anonymous - # Cleaning Service Configurations + # Cleaning Service Configurations cleaningService: - pollingCron: '-' + pollingCron: '-' + +# Logging Configuration +logging: + unknown-user: Anonymous + pattern: + console: "%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) %green([%-10.10X{user:-System}]) %magenta([%-10.10X{request:-No Request}]) %yellow([%-15.15t]) %cyan(%-40.40logger{39}) : %m%n%wEx" + level: + root: INFO + org: + eclipse: + tractusx: + bpdm: + cleaning: DEBUG # Enable actuator endpoints management: - endpoint: - health: - probes: - enabled: true + endpoint: health: - livenessState: - enabled: true - readinessState: - enabled: true + probes: + enabled: true + health: + livenessState: + enabled: true + readinessState: + enabled: true # Springdoc swagger configuration springdoc: diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/BusinessPartnerService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/BusinessPartnerService.kt index 69f73adce..5e50b1add 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/BusinessPartnerService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/BusinessPartnerService.kt @@ -19,6 +19,7 @@ package org.eclipse.tractusx.bpdm.gate.service +import mu.KotlinLogging import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.response.PageDto import org.eclipse.tractusx.bpdm.common.model.StageType @@ -56,9 +57,11 @@ class BusinessPartnerService( private val orchestratorMappings: OrchestratorMappings, private val sharingStateRepository: SharingStateRepository ) { + private val logger = KotlinLogging.logger { } @Transactional fun upsertBusinessPartnersInput(dtos: List): List { + logger.debug { "Executing upsertBusinessPartnersInput() with parameters $dtos" } val entities = dtos.map { dto -> businessPartnerMappings.toBusinessPartnerInput(dto) } //Validation method val validatedEntities = filterUpdateCandidates(entities, StageType.Input) @@ -67,17 +70,20 @@ class BusinessPartnerService( @Transactional fun upsertBusinessPartnersOutput(dtos: Collection): Collection { + logger.debug { "Executing upsertBusinessPartnersOutput() with parameters $dtos" } val entities = dtos.map { dto -> businessPartnerMappings.toBusinessPartnerOutput(dto) } return upsertBusinessPartnersOutputFromCandidates(entities).map(businessPartnerMappings::toBusinessPartnerOutputDto) } fun getBusinessPartnersInput(pageRequest: PageRequest, externalIds: Collection?): PageDto { + logger.debug { "Executing getBusinessPartnersInput() with parameters $pageRequest and $externalIds" } val stage = StageType.Input return getBusinessPartners(pageRequest, externalIds, stage) .toPageDto(businessPartnerMappings::toBusinessPartnerInputDto) } fun getBusinessPartnersOutput(pageRequest: PageRequest, externalIds: Collection?): PageDto { + logger.debug { "Executing getBusinessPartnersOutput() with parameters $pageRequest and $externalIds" } val stage = StageType.Output return getBusinessPartners(pageRequest, externalIds, stage) .toPageDto(businessPartnerMappings::toBusinessPartnerOutputDto) diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ChangelogService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ChangelogService.kt index 5104a0afd..ba98479d4 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ChangelogService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/ChangelogService.kt @@ -19,6 +19,7 @@ package org.eclipse.tractusx.bpdm.gate.service +import mu.KotlinLogging import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.model.StageType import org.eclipse.tractusx.bpdm.gate.api.exception.ChangeLogOutputError @@ -38,6 +39,8 @@ import java.time.Instant @Service class ChangelogService(private val changelogRepository: ChangelogRepository) { + private val logger = KotlinLogging.logger { } + fun getChangeLogEntries( externalIds: Set?, businessPartnerTypes: Set?, @@ -47,6 +50,8 @@ class ChangelogService(private val changelogRepository: ChangelogRepository) { pageSize: Int ): PageChangeLogDto { + logger.debug { "Executing getChangeLogEntries() with parameters $externalIds // $businessPartnerTypes // $stage // $createdAt" } + val nonNullExternalIds = externalIds ?: emptySet() val spec = Specification.allOf( diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/DocumentationService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/DocumentationService.kt index 86abdf60d..b9af802b5 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/DocumentationService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/DocumentationService.kt @@ -20,6 +20,7 @@ package org.eclipse.tractusx.bpdm.gate.service import jakarta.persistence.EntityManager +import mu.KotlinLogging import org.eclipse.tractusx.bpdm.common.util.JpaMermaidCreator import org.eclipse.tractusx.bpdm.common.util.JpaMetaModelReader import org.springframework.stereotype.Service @@ -32,8 +33,10 @@ class DocumentationService( val entityManager: EntityManager ) { - fun getMermaidGatePersistence(): String { + private val logger = KotlinLogging.logger { } + fun getMermaidGatePersistence(): String { + logger.info { "Executing getMermaidGatePersistence()" } val allClassInfos = JpaMetaModelReader().createJpaClassInfos(this.entityManager.metamodel) return JpaMermaidCreator().getMermaid(allClassInfos, "Gate persistence") } diff --git a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SharingStateService.kt b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SharingStateService.kt index 26b6f2c6c..893324085 100644 --- a/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SharingStateService.kt +++ b/bpdm-gate/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/service/SharingStateService.kt @@ -19,6 +19,7 @@ package org.eclipse.tractusx.bpdm.gate.service +import mu.KotlinLogging import org.eclipse.tractusx.bpdm.common.dto.BusinessPartnerType import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.common.dto.response.PageDto @@ -43,10 +44,13 @@ const val ERROR_MISSING_TASK = "Request for Pending state but no task-id specifi @Service class SharingStateService(private val stateRepository: SharingStateRepository) { + private val logger = KotlinLogging.logger { } + /** * Upsert fixed sharing state based on given DTO */ fun upsertSharingState(request: SharingStateDto) { + logger.info { "Executing upsertSharingState() with parameters $request" } val sharingState = getOrCreate(request.externalId, request.businessPartnerType) when (request.sharingStateType) { @@ -79,6 +83,8 @@ class SharingStateService(private val stateRepository: SharingStateRepository) { externalIds: Collection? ): PageDto { + logger.info { "findSharingStates() called with $paginationRequest // $businessPartnerType and $externalIds" } + val pageRequest = PageRequest.of(paginationRequest.page, paginationRequest.size) val spec = Specification.allOf(byExternalIdsIn(externalIds), byBusinessPartnerType(businessPartnerType)) val sharingStatePage = stateRepository.findAll(spec, pageRequest) diff --git a/bpdm-gate/src/main/resources/application-auth.yml b/bpdm-gate/src/main/resources/application-auth.yml index a3960d8d8..912cc3294 100644 --- a/bpdm-gate/src/main/resources/application-auth.yml +++ b/bpdm-gate/src/main/resources/application-auth.yml @@ -41,6 +41,7 @@ bpdm: refresh-url: ${bpdm.security.token-url} token-url: ${bpdm.security.auth-server-url}/realms/${bpdm.security.realm}/protocol/openid-connect/token + #Spring OAuth configuration spring: security: diff --git a/bpdm-gate/src/main/resources/application.yml b/bpdm-gate/src/main/resources/application.yml index 54734f44c..bd0720bbd 100644 --- a/bpdm-gate/src/main/resources/application.yml +++ b/bpdm-gate/src/main/resources/application.yml @@ -35,10 +35,6 @@ bpdm: api: upsert-limit: 100 - # Logging Configuration - logging: - unknown-user: Anonymous - # Cleaning Task Job Configurations goldenRecordTask: pollingCron: '-' @@ -60,6 +56,19 @@ bpdm: datasource: host: localhost +# Logging Configuration +logging: + unknown-user: Anonymous + pattern: + console: "%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) %green([%-10.10X{user:-System}]) %magenta([%-10.10X{request:-No Request}]) %yellow([%-15.15t]) %cyan(%-40.40logger{39}) : %m%n%wEx" + level: + root: INFO + org: + eclipse: + tractusx: + bpdm: + gate: DEBUG + # Enable actuator endpoints management: endpoint: diff --git a/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/service/GoldenRecordTaskService.kt b/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/service/GoldenRecordTaskService.kt index e6901968a..b7f955226 100644 --- a/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/service/GoldenRecordTaskService.kt +++ b/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/service/GoldenRecordTaskService.kt @@ -42,6 +42,7 @@ class GoldenRecordTaskService( @Synchronized fun createTasks(createRequest: TaskCreateRequest): TaskCreateResponse { + logger.debug { "Creation of new golden record tasks: executing createTasks() with parameters $createRequest" } return createRequest.businessPartners .map { businessPartnerGeneric -> taskStorage.addTask(initTask(createRequest, businessPartnerGeneric)) } .map(::toTaskClientStateDto) @@ -50,6 +51,7 @@ class GoldenRecordTaskService( @Synchronized fun searchTaskStates(stateRequest: TaskStateRequest): TaskStateResponse { + logger.debug { "Search for the state of golden record task: executing searchTaskStates() with parameters $stateRequest" } return stateRequest.taskIds .mapNotNull { taskId -> taskStorage.getTask(taskId) } // skip missing tasks .map(::toTaskClientStateDto) @@ -58,6 +60,7 @@ class GoldenRecordTaskService( @Synchronized fun reserveTasksForStep(reservationRequest: TaskStepReservationRequest): TaskStepReservationResponse { + logger.debug { "Reservation of next golden record tasks: executing reserveTasksForStep() with parameters $reservationRequest" } val now = Instant.now() val tasks = taskStorage.getQueuedTasksByStep(reservationRequest.step, reservationRequest.amount) @@ -81,6 +84,7 @@ class GoldenRecordTaskService( @Synchronized fun resolveStepResults(resultRequest: TaskStepResultRequest) { + logger.debug { "Step results for reserved golden record tasks: executing resolveStepResults() with parameters $resultRequest" } resultRequest.results .forEach { resultEntry -> val task = taskStorage.getTask(resultEntry.taskId) diff --git a/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/service/GoldenRecordTaskStateMachine.kt b/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/service/GoldenRecordTaskStateMachine.kt index a611fc841..7d759a202 100644 --- a/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/service/GoldenRecordTaskStateMachine.kt +++ b/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/service/GoldenRecordTaskStateMachine.kt @@ -19,6 +19,7 @@ package org.eclipse.tractusx.bpdm.orchestrator.service +import mu.KotlinLogging import org.eclipse.tractusx.bpdm.orchestrator.config.TaskConfigProperties import org.eclipse.tractusx.bpdm.orchestrator.exception.BpdmIllegalStateException import org.eclipse.tractusx.bpdm.orchestrator.model.GoldenRecordTask @@ -32,7 +33,10 @@ class GoldenRecordTaskStateMachine( val taskConfigProperties: TaskConfigProperties ) { + private val logger = KotlinLogging.logger { } + fun initProcessingState(mode: TaskMode): TaskProcessingState { + logger.debug { "Executing initProcessingState() with parameters $mode" } val now = Instant.now() val initialStep = getInitialStep(mode) @@ -53,6 +57,7 @@ class GoldenRecordTaskStateMachine( } fun doReserve(task: GoldenRecordTask) { + logger.debug { "Executing doReserve() with parameters $task" } val state = task.processingState val now = Instant.now() @@ -66,6 +71,7 @@ class GoldenRecordTaskStateMachine( } fun doResolveTaskToSuccess(task: GoldenRecordTask, step: TaskStep, resultBusinessPartner: BusinessPartnerFullDto) { + logger.debug { "Executing doResolveTaskToSuccess() with parameters $task // $step and $resultBusinessPartner" } val state = task.processingState val now = Instant.now() @@ -89,6 +95,7 @@ class GoldenRecordTaskStateMachine( } fun doResolveTaskToError(task: GoldenRecordTask, step: TaskStep, errors: List) { + logger.debug { "Executing doResolveTaskToError() with parameters $task // $step and $errors" } val state = task.processingState if (state.resultState != ResultState.Pending || state.stepState != StepState.Reserved || state.step != step) { diff --git a/bpdm-orchestrator/src/main/resources/application-auth.yml b/bpdm-orchestrator/src/main/resources/application-auth.yml index 4f9528878..adda67db2 100644 --- a/bpdm-orchestrator/src/main/resources/application-auth.yml +++ b/bpdm-orchestrator/src/main/resources/application-auth.yml @@ -23,6 +23,7 @@ bpdm: createTask: create_task processTaskPrefix: process_task_step viewTask: view_task + # OAuth configuration security: cors-origins: '*' diff --git a/bpdm-orchestrator/src/main/resources/application.yml b/bpdm-orchestrator/src/main/resources/application.yml index 77bf37e1b..f9fa581a8 100644 --- a/bpdm-orchestrator/src/main/resources/application.yml +++ b/bpdm-orchestrator/src/main/resources/application.yml @@ -20,6 +20,19 @@ bpdm: taskPendingTimeout: 3d taskRetentionTimeout: 30d +# Logging Configuration +logging: + unknown-user: Anonymous + pattern: + console: "%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) %green([%-10.10X{user:-System}]) %magenta([%-10.10X{request:-No Request}]) %yellow([%-15.15t]) %cyan(%-40.40logger{39}) : %m%n%wEx" + level: + root: INFO + org: + eclipse: + tractusx: + bpdm: + orchestrator: DEBUG + # Enable actuator endpoints management: endpoint: diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/AddressService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/AddressService.kt index bbfd76954..54c9ae788 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/AddressService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/AddressService.kt @@ -20,6 +20,7 @@ package org.eclipse.tractusx.bpdm.pool.service import jakarta.transaction.Transactional +import mu.KotlinLogging import org.eclipse.tractusx.bpdm.common.dto.request.AddressPartnerBpnSearchRequest import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.common.dto.response.LogisticAddressVerboseDto @@ -40,7 +41,10 @@ class AddressService( private val legalEntityRepository: LegalEntityRepository, private val siteRepository: SiteRepository, ) { + private val logger = KotlinLogging.logger { } + fun findByPartnerBpn(bpn: String, pageIndex: Int, pageSize: Int): PageDto { + logger.debug { "Executing findByPartnerBpn() with parameters $bpn // $pageIndex // $pageSize" } if (!legalEntityRepository.existsByBpn(bpn)) { throw BpdmNotFoundException("Business Partner", bpn) } @@ -51,6 +55,7 @@ class AddressService( } fun findByBpn(bpn: String): LogisticAddressVerboseDto { + logger.debug { "Executing findByBpn() with parameters $bpn" } val address = logisticAddressRepository.findByBpn(bpn) ?: throw BpdmNotFoundException("Address", bpn) return address.toDto() } @@ -60,6 +65,8 @@ class AddressService( searchRequest: AddressPartnerBpnSearchRequest, paginationRequest: PaginationRequest ): PageDto { + logger.debug { "Executing findByPartnerAndSiteBpns() with parameters $searchRequest and $paginationRequest" } + val partners = if (searchRequest.legalEntities.isNotEmpty()) legalEntityRepository.findDistinctByBpnIn(searchRequest.legalEntities) else emptyList() val sites = if (searchRequest.sites.isNotEmpty()) siteRepository.findDistinctByBpnIn(searchRequest.sites) else emptyList() @@ -74,6 +81,7 @@ class AddressService( } fun findLegalAddresses(bpnLs: Collection): Collection { + logger.debug { "Executing findLegalAddresses() with parameters $bpnLs" } val legalEntities = legalEntityRepository.findDistinctByBpnIn(bpnLs) legalEntityRepository.joinLegalAddresses(legalEntities) val addresses = legalEntities.map { it.legalAddress } @@ -82,6 +90,7 @@ class AddressService( } fun findMainAddresses(bpnS: Collection): Collection { + logger.debug { "Executing findMainAddresses() with parameters $bpnS" } val sites = siteRepository.findDistinctByBpnIn(bpnS) siteRepository.joinAddresses(sites) val addresses = sites.map { it.mainAddress } diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt index edb13eb9b..0a382d707 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/BusinessPartnerFetchService.kt @@ -19,6 +19,7 @@ package org.eclipse.tractusx.bpdm.pool.service +import mu.KotlinLogging import org.eclipse.tractusx.bpdm.common.dto.IdentifierBusinessPartnerType import org.eclipse.tractusx.bpdm.common.exception.BpdmNotFoundException import org.eclipse.tractusx.bpdm.pool.api.model.response.BpnIdentifierMappingDto @@ -45,10 +46,13 @@ class BusinessPartnerFetchService( private val addressService: AddressService ) { + private val logger = KotlinLogging.logger { } + /** * Fetch a business partner by [bpn] and return as [LegalEntityWithLegalAddressVerboseDto] */ fun findLegalEntityIgnoreCase(bpn: String): LegalEntityWithLegalAddressVerboseDto { + logger.debug { "Executing findLegalEntityIgnoreCase() with parameters $bpn" } return findLegalEntityOrThrow(bpn).toLegalEntityWithLegalAddress() } @@ -58,6 +62,7 @@ class BusinessPartnerFetchService( */ @Transactional fun findLegalEntityIgnoreCase(identifierType: String, identifierValue: String): LegalEntityWithLegalAddressVerboseDto { + logger.debug { "Executing findLegalEntityIgnoreCase() with parameters $identifierType and $identifierValue" } return findLegalEntityOrThrow(identifierType, identifierValue).toLegalEntityWithLegalAddress() } @@ -66,6 +71,7 @@ class BusinessPartnerFetchService( */ @Transactional fun fetchByBpns(bpns: Collection): Set { + logger.debug { "Executing fetchByBpns() with parameters $bpns " } return fetchLegalEntityDependencies(legalEntityRepository.findDistinctByBpnIn(bpns)) } @@ -74,6 +80,7 @@ class BusinessPartnerFetchService( */ @Transactional fun fetchDtosByBpns(bpns: Collection): Collection { + logger.debug { "Executing fetchDtosByBpns() with parameters $bpns " } return fetchByBpns(bpns).map { it.toLegalEntityWithLegalAddress() } } @@ -86,6 +93,7 @@ class BusinessPartnerFetchService( businessPartnerType: IdentifierBusinessPartnerType, idValues: Collection ): Set { + logger.debug { "Executing findBpnsByIdentifiers() with parameters $identifierTypeKey // $businessPartnerType and $idValues" } val identifierType = findIdentifierTypeOrThrow(identifierTypeKey, businessPartnerType) return when (businessPartnerType) { IdentifierBusinessPartnerType.LEGAL_ENTITY -> legalEntityIdentifierRepository.findBpnsByIdentifierTypeAndValues(identifierType, idValues) diff --git a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/SiteService.kt b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/SiteService.kt index 5d57285b4..efe5883a3 100644 --- a/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/SiteService.kt +++ b/bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/SiteService.kt @@ -19,6 +19,7 @@ package org.eclipse.tractusx.bpdm.pool.service +import mu.KotlinLogging import org.eclipse.tractusx.bpdm.common.dto.request.PaginationRequest import org.eclipse.tractusx.bpdm.common.dto.request.SiteBpnSearchRequest import org.eclipse.tractusx.bpdm.common.dto.response.PageDto @@ -37,7 +38,10 @@ class SiteService( private val legalEntityRepository: LegalEntityRepository, private val addressService: AddressService ) { + private val logger = KotlinLogging.logger { } + fun findByPartnerBpn(bpn: String, pageIndex: Int, pageSize: Int): PageDto { + logger.debug { "Executing findByPartnerBpn() with parameters $bpn // $pageIndex // $pageSize" } if (!legalEntityRepository.existsByBpn(bpn)) { throw BpdmNotFoundException("Business Partner", bpn) } @@ -48,6 +52,7 @@ class SiteService( } fun findByPartnerBpns(siteSearchRequest: SiteBpnSearchRequest, paginationRequest: PaginationRequest): PageDto { + logger.debug { "Executing findByPartnerBpns() with parameters $siteSearchRequest // $paginationRequest" } val partners = if (siteSearchRequest.legalEntities.isNotEmpty()) legalEntityRepository.findDistinctByBpnIn(siteSearchRequest.legalEntities) else emptyList() val sitePage = @@ -57,6 +62,7 @@ class SiteService( } fun findByBpn(bpn: String): SitePoolVerboseDto { + logger.debug { "Executing findByBpn() with parameters $bpn " } val site = siteRepository.findByBpn(bpn) ?: throw BpdmNotFoundException("Site", bpn) return site.toPoolDto() } diff --git a/bpdm-pool/src/main/resources/application.yml b/bpdm-pool/src/main/resources/application.yml index 81d8c679b..26afb0a0c 100644 --- a/bpdm-pool/src/main/resources/application.yml +++ b/bpdm-pool/src/main/resources/application.yml @@ -38,10 +38,6 @@ bpdm: controller: search-request-limit: 100 - # Logging Configuration - logging: - unknown-user: Anonymous - # Orchestrator Client client: pool-orchestrator: @@ -60,6 +56,19 @@ bpdm: datasource: host: localhost +# Logging Configuration +logging: + unknown-user: Anonymous + pattern: + console: "%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) %green([%-10.10X{user:-System}]) %magenta([%-10.10X{request:-No Request}]) %yellow([%-15.15t]) %cyan(%-40.40logger{39}) : %m%n%wEx" + level: + root: INFO + org: + eclipse: + tractusx: + bpdm: + pool: DEBUG + # Enable actuator endpoints management: endpoint: diff --git a/bpdm-pool/src/main/resources/logback-spring.xml b/bpdm-pool/src/main/resources/logback-spring.xml deleted file mode 100644 index 91a57b1c2..000000000 --- a/bpdm-pool/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr([%-20.20X{user:-System}]){blue} %clr([%-36.36X{request:-No Request}]){magenta} %clr([%-15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx - - utf8 - - - - - - - %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr([%-15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx - - utf8 - - - - - - - - - - - - - - - \ No newline at end of file