Camunda logging without stack trace

Hi everyone,

Trying to find solution for logging stack trace for explicitly thrown errors in java code such as:

  • FormValidationException and FormFieldValidationException (should log message, not full stack trace if a user for example, violates minimal number constraint or a more sofisticated validation fails)
    -DelegateExceptions thrown explicitly from delegate classes.

We are using standard - slf4j logging.
If any additional info needed, please write.

Thank you in advance,

That’s not really about camunda, but about your logging implementation. Do you use log4j? You can use some logging layout which can be configured to not display stacktrace:

Actually, Camunda classes are doing the stack trace logging.
If a delegate class throws Exception with message, Throwable null, enableSuppression true and writableStackTrace false, custom Exception thrown from delegate does not cause printing the stack trace, Camunda classes do (CommandInvocationContext , method invokeNext,
Is there any way to shut that down?

It’s hard to read your last post, but when I tried to throw an exception from JavaDelegate, it’s handled in PvmAtomicOperationActivityExecute by rethrowing it wrapped in PvmException. So it creates another stacktrace which is then passed to slf4j and then to your loggin implementation. And it’s up to the implementation how it will get handled. If the whole stacktrace is somewhere set as an exception message, then there’s a problem, but I doubt that’s the case.

I’m using log4j2 implementation and I can add %ex{short} to my PatternLayout and then I will only get the first line of the stacktrace and there are other options:

Yes, PvmException is rethrowing the stacktrace.
Using PatternLayout with %ex{short} would effect each PvmException thrown during execution of Camunda process, which is not an option considering full stacktrace is sometimes necessary. In your case, did using PatternLayout effect every Exception thrown by Camunda classes?

Yes, of course. But if you look at the code, there’s obviously no way to easily configure this behavior. So you need to find some hack… replace the classes where exceptions are thrown(I don’t know if that’s possible using camunda plugin mechanism), configure the logger for different exceptions, write custom logging appender, …