Hey,
I´m just playing around with process instance migration plans. When my migration plan fails e.g. caused by a missing activity in the target definition, I get a MigratingProcessInstanceValidationException. Fine so far. My problem is that this exception is logged by the CommandContext automatically. I want to catch the exception and log the relevant information by myself. Even debugging the code did not enable me to solve this problem.
Is it even possible to bar the engine from logging migration exceptions automatically?
Thanks in advance!
Best regards!
Carsten
Hi Carsten,
This kinf of logging is implemented in org.camunda.bpm.engine.impl.interceptor.CommandContext#close
. You can redirect it to log level FINE
by subclassing and overriding #shouldLogFine
, then extending org.camunda.bpm.engine.impl.interceptor.CommandContextFactory
and then replacing the engine’s command context factory in the process engine configuration.
For custom logging, you could add an implementation of org.camunda.bpm.engine.impl.interceptor.CommandInterceptor
that logs what you want. Then again, register the interceptor in the process engine configuration.
Cheers,
Thorben
Hi Thorben,
thanks, this works fine.
If I want to have the same behaviour within the batch migration, it seems to be a much more invasive code change. The only way I found by myself is to add a catch block in org.camunda.bpm.engine.impl.interceptor.CommandContext#runWithoutAuthorization
and parse the exception text for ‘ENGINE-23’ in it, which seems to be a migration exception. If this is the only way to handle migration exceptions I think that I will prefer the default logging instead of adding my own handler code. But maybe I do not see the nearby solution?!
Best regards,
Carsten
Hi Carsten,
Doesn’t the solution I pointed out work for batches in the same way? I’m wondering because a batch is divided into jobs and executing a job is just another command.
Cheers,
Thorben
Hi Thorben,
I was shocked when I just realized that I did not answer to your reply any more. I´m so sorry for that! Somehow the problem was solved by itself, so that I did not try to reproduce it any more. I must have done something wrong before.
Best regards,
Carsten
1 Like