Skip to content

Commit

Permalink
Merge pull request #135 from pagopa/PAGOPA-2298-opt-log
Browse files Browse the repository at this point in the history
feat: [PAGOPA-2298] opt log
  • Loading branch information
alessio-acitelli authored Oct 18, 2024
2 parents 0456a69 + 137db55 commit 4d0ff99
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
13 changes: 9 additions & 4 deletions host.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@
}
},
"logging": {
"fileLoggingMode": "always",
"fileLoggingMode": "debugOnly",
"logLevel": {
"default": "Information",
"default": "None",
"Host.Results": "Error",
"Function": "Information",
"Host.Aggregator": "Trace"
"Function.GenerateReceiptProcess": "Information",
"Function.ManageReceiptPoisonQueueProcessor": "Information",
"Function.RetryReviewedPoisonMessagesProcessor": "Information",
"Microsoft": "Information",
"Worker": "Information",
"Host.Aggregator": "Error",
"Host": "Error"
},
"applicationInsights": {
"samplingSettings": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public void processGenerateReceipt(
return;
}

logger.info("[{}] Generating pdf for Receipt with id {} and eventId {}",
logger.debug("[{}] Generating pdf for Receipt with id {} and eventId {}",
context.getFunctionName(),
receipt.getId(),
receiptEventReference);
Expand All @@ -179,7 +179,7 @@ public void processGenerateReceipt(
if (success) {
receipt.setStatus(ReceiptStatusType.GENERATED);
receipt.setGenerated_at(System.currentTimeMillis());
logger.info("[{}] Receipt with id {} being saved with status {}",
logger.debug("[{}] Receipt with id {} being saved with status {}",
context.getFunctionName(),
receipt.getEventId(),
receipt.getStatus());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void processManageReceiptPoisonQueue(
//attempt to Map queue bizEventMessage to BizEvent
listOfBizEvents = ObjectMapperUtils.mapBizEventListString(errorMessage, new TypeReference<>() {});
bizEvent = listOfBizEvents.get(0);
logger.info("[{}] function called at {} recognized as valid BizEvent with id {}",
logger.debug("[{}] function called at {} recognized as valid BizEvent with id {}",
context.getFunctionName(), LocalDateTime.now(), bizEvent.getId());
if (Boolean.TRUE.equals(bizEvent.getAttemptedPoisonRetry())) {
logger.info("[{}] function called at {} for event with id {} has ingestion already retried, sending to review",
Expand Down Expand Up @@ -151,7 +151,7 @@ private void saveToReceiptError(ExecutionContext context, String errorMessage, S
String encodedEvent = Aes256Utils.encrypt(errorMessage);
receiptError.setMessagePayload(encodedEvent);

logger.info("[{}] saving new entry to the retry error to review with payload {}",
logger.debug("[{}] saving new entry to the retry error to review with payload {}",
context.getFunctionName(), encodedEvent);
} catch (Aes256Exception e) {
receiptError.setMessageError(e.getMessage());
Expand All @@ -167,7 +167,7 @@ private void updateReceiptToReview(ExecutionContext context, String eventId,

receipt.setStatus(ReceiptStatusType.TO_REVIEW);

logger.info("[{}] updating receipt with id {} to status {}",
logger.debug("[{}] updating receipt with id {} to status {}",
context.getFunctionName(), receipt.getId(), ReceiptStatusType.TO_REVIEW);
receiptOutputBinding.setValue(receipt);
} catch (ReceiptNotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void processRetryReviewedPoisonMessages(
private void updateReceiptToInserted(ExecutionContext context, String bizEventId) throws ReceiptNotFoundException, UnableToSaveException {
Receipt receipt = this.receiptCosmosService.getReceipt(bizEventId);
receipt.setStatus(ReceiptStatusType.INSERTED);
logger.info("[{}] updating receipt with id {} to status {}", context.getFunctionName(), receipt.getId(), ReceiptStatusType.INSERTED);
logger.debug("[{}] updating receipt with id {} to status {}", context.getFunctionName(), receipt.getId(), ReceiptStatusType.INSERTED);
this.receiptCosmosService.updateReceipt(receipt);
}
}

0 comments on commit 4d0ff99

Please sign in to comment.