From 0c9d79670f8e9d20662d8424f93bed6c6738a139 Mon Sep 17 00:00:00 2001 From: Stephan Pelikan Date: Wed, 18 Dec 2024 13:35:53 +0100 Subject: [PATCH] Improve logging in case of errors --- .../camunda8/service/Camunda8ProcessService.java | 12 ++++++++++-- .../service/Camunda8TransactionProcessor.java | 14 ++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/spring-boot/src/main/java/io/vanillabp/camunda8/service/Camunda8ProcessService.java b/spring-boot/src/main/java/io/vanillabp/camunda8/service/Camunda8ProcessService.java index 7311d23..59028d8 100644 --- a/spring-boot/src/main/java/io/vanillabp/camunda8/service/Camunda8ProcessService.java +++ b/spring-boot/src/main/java/io/vanillabp/camunda8/service/Camunda8ProcessService.java @@ -368,13 +368,21 @@ private DE runInTransaction( .timeout(Duration.ofMinutes(10)) .send() .join(5, TimeUnit.MINUTES), // needs to run synchronously - () -> "aggregate: " + aggregateId + "; bpmn-process-id: " + bpmnProcessId)); + () -> "UpdateTimeout on '" + + taskIdToTestForAlreadyCompletedOrCancelled + + "' for aggregate: " + + aggregateId + + "; bpmn-process-id: " + + bpmnProcessId)); } publisher.publishEvent( new Camunda8TransactionProcessor.Camunda8CommandAfterTx( methodSignature, () -> runnable.accept(attachedAggregate), - () -> "aggregate: " + aggregateId + "; bpmn-process-id: " + bpmnProcessId)); + () -> "aggregate: " + + aggregateId + + "; bpmn-process-id: " + + bpmnProcessId)); } else { runnable.accept(attachedAggregate); } diff --git a/spring-boot/src/main/java/io/vanillabp/camunda8/service/Camunda8TransactionProcessor.java b/spring-boot/src/main/java/io/vanillabp/camunda8/service/Camunda8TransactionProcessor.java index 56b2321..cc36ca2 100644 --- a/spring-boot/src/main/java/io/vanillabp/camunda8/service/Camunda8TransactionProcessor.java +++ b/spring-boot/src/main/java/io/vanillabp/camunda8/service/Camunda8TransactionProcessor.java @@ -108,12 +108,17 @@ public void processPreCommit( if ((e instanceof ClientStatusException clientStatusException) && (clientStatusException.getStatus().getCode() == Status.NOT_FOUND.getCode())) { throw new RuntimeException( - "Will rollback because job was already completed/cancelled! Test-command giving status 'NOT_FOUND':\n" + "Will rollback '" + + event.getSource() + + "' because job was already completed/cancelled! Test-command giving status 'NOT_FOUND':\n" + event.description.get()); } else { throw new RuntimeException( - "Will rollback because testing for job '{}' failed! Test-command:\n" - + event.description.get()); + "Will rollback because testing for job due to '" + + event.getSource() + + "'! Test-command:\n" + + event.description.get(), + e); } } @@ -133,8 +138,9 @@ public void processPostCommit( event.runnable.run(); } catch (Exception e) { logger.error( - "Could not execute camunda command for '{}'! Manual action required!", + "Could not execute camunda command for '{}' initiated by: {}! Manual action required!", event.description.get(), + event.getSource(), e); }