cancel
Showing results for 
Search instead for 
Did you mean: 

Supress exception stacktrace

markusfaeth
Champ in-the-making
Champ in-the-making
Hello, we think it is pretty simple and straight forward to throw exceptions in custom workflow logic (like listeners, service tasks, script tasks) when ever there is a problem, of which the current user can be informed with a very specific message. For instance, that could be caused by validation of form data. The good thing about the exception is, that the workflow transaction is rolled back and everthing is fine, the user can now try again because we also roll back all of our transactions on any exception. But this has only one downside: everytime the user tries to submit the form (e.g.), a stack trace is printed and/or logged in file, which is totally unnecessary. Can I somehow influence the handling of that exceptions thrown within workflow logic? Best would be: the trace only gets printed if the nested exception (the exception we threw and is nested in an ActivitiException) is not of a certain custom type. Do you have any suggestions? Thank you!
3 REPLIES 3

markus_menner
Champ in-the-making
Champ in-the-making
Hi,
I'm facing the same problem.
Any ideas?
Thanks,
Markus

markus_menner
Champ in-the-making
Champ in-the-making
Hi,

I've determined that CommandContext is the source of this behavior.
Once the command context is closed, any exception will be logged there.
Of course I can set the loglevel for CommandContext accordingly to shut it up, but it might be better to only re-throw any Exception by default?

Regards,
Markus

trademak
Star Contributor
Star Contributor
The typical use case is that if an exception occurs and a transaction is rollbacked, the stacktrace should be logged. But I can imagine that there are cases where this isn't the desired behavior. Maybe we could add a Activiti engine wide property that doesn't log exceptions of a specific type. Is that what you are looking for?

Best regards,