This content has been marked as final.
Show 3 replies
-
1. Re: Tracing the Process Instance
akakunin Mar 24, 2006 2:22 AM (in response to romin.irani)Yes, of cource - it is LogInstances
Here is simples way to get all tracing information for the root token of the process instance:LoggingSession logSession = JbpmContext.getCurrentContext().getLoggingSession(); Map logMap = logSession.findLogsByProcessInstance(m_process.getId()); List resultLogs = new ArrayList(); Collection logs = (Collection)logMap.get(processInstance.getRootToken());
-
2. Re: Tracing the Process Instance
kukeltje Mar 24, 2006 11:38 AM (in response to romin.irani)but there might be more than a root token. You should check for child tokens as well.
-
3. Re: Tracing the Process Instance
romin.irani Mar 27, 2006 7:15 AM (in response to romin.irani)Thanks for the replies. This has helped me going -- but I still have lots of questions:
1) I had overlooked the documentation and I was not calling a ctx.save(ProcessInstance). As a result of this, the JBPM_LOG table was empty. I added the ctx.save(...) call and now the table is getting populated.
However, I need to confirm / clarify / ask the following:
1) I am starting my Processes by using the following code:JbpmConfiguration jbpmConfig = JbpmConfiguration.getInstance(); JbpmContext ctx = jbpmConfig.createJbpmContext(); try { //Create Instance ProcessInstance PI = ctx.getGraphSession().findLatestProcessDefinition("some-process-def").createProcessInstance(); //Initialize Process Context Variables Map ProcessMap = new HashMap(); ProcessMap.put("...",...); PI.getContextInstance().addVariables(ProcessMap); //Start the Process PI.getRootToken().signal(); ctx.save(PI); System.out.println(PI.hasEnded()); } catch (Exception e) { System.out.println(e.toString()); } finally { ctx.close(); }
Is the above piece of code good enough? Am I still missing something?
2) My process definitions typically consist of Automatic Nodes -- where I have either a beanshell script doing something or an ActionHandler implementation. How can make sure that everything that happens in each of these nodes gets logged into the JBPM_LOG table. Is the above code good enough.
3) If my server is halted while executing some workflow instances, then I have written code that will load all running Process instances on startup and signal them to continue execution. Should I load all these Instances with a loadProcessInstanceforUpdate and then signal() -- so that everything is logged?
4) If I am handling a Task Node, should I load the task with LoadTaskInstanceforUpdate() and then do a TaskInstance.end() -- so that everything is logged?
I would like to be pointed out to some sample code (if possible ) in the test package so that I can view how the complete logs can be retrieved from the Database.
Could someone explain the logic behind retrieving the logs as pointed out by the posts below. I used the: LoggingSession logSession = JbpmContext.getCurrentContext().getLoggingSession(); Map logMap = logSession.findLogsByProcessInstance(m_process.getId()
Isnt this sufficient ? Do we have some utility method somewhere that simply prints like a toString() of the whole Log for the instance. That would more than meet the requirements from the purpose of debugging by reading this log quickly.