Camunda API Exception shorter log messages

I am using the Spring Boot application with Camunda engine 7.19, Is there a way to configure the Camunda API to log shorter exception messages or stack traces, avoiding verbose output such as full stack traces in the console?

Hello my friend!

I believe you can create a custom global exception handler to catch any exception using @ControllerAdvice and @ExceptionHandler", and print just the message… I believe it will work.

You can do it more or less like this:

@ControllerAdvice
public class GlobalExceptionHandler {

     @ExceptionHandler(Exception.class)
     public void handleException(Exception e) {
        
         System.err.println("An error occurred: " + e.getMessage());
    
     }
}

This will handle any exception you receive, logging just the error message in a simple way…

You can also use a logger of your choice, such as Slf4j.

I hope this helps!

William Robert Alves

Hello @WilliamR.Alves, thank you as always for your response. I’ve tried using ControllerAdvice, but it doesn’t seem to work for me. Specifically, I’m looking to handle exceptions that are not related to BPMN errors, such as the ‘Unknown property used in expression: ${action2==1}’ error, or exceptions arising from script tasks.

Hello!

There is a parameter that you can configure in your application.properties or application.yml, which may help you resolve this issue.

Below I will leave the link to the official doc.

William Robert Alves

Thank you @WilliamR.Alves

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.