2 Replies Latest reply on Apr 2, 2008 3:40 AM by jbarrez

    No logging to JBPM_LOG when process instance ends

    jbarrez

      I know that in order to flush the logs to the JBPM_LOG table, one has to call the jbpmContext.save(processInstance) method (as described in the user guide)

      However, I found it strange that no call to this method is made when the processInstance is ended.
      More specifically, when one forgets to call the save method, I assumed that the end() method of the processInstance would act like a 'catch-all' and flushes the log.

      With the current implementation, all logs are gone when the call to the save() method is taken away and the process ends.
      It is obvious that this is quite error-prone, I had assumed the logging was automatic.

      Am I missing something here or is it like I just described?

        • 1. Re: No logging to JBPM_LOG when process instance ends
          kukeltje

           

          I assumed that the end() method of the processInstance would act like a 'catch-all' and flushes the log.
          Assumptions are always dangerous ;-) Why not assume that when signalling a token/process would do the same?

          Seriously... to me there is no difference. I just have to make sure I always do this... just like with any plain hibernate thing...

          • 2. Re: No logging to JBPM_LOG when process instance ends
            jbarrez

            Indeed, assuming that it happens when signalling a token would do the same.
            But when I checked the sourcecode, this ain't happening.

            The ProcessLogs are added to the LoggingInstance, but the problem is that this are non-persisted objects at that point.

            Until the call to the jbpmContext.save(processInstance) is made, resulting in calling the loggingService which will do a session.save(ProcessLog), Hibernate simply does *not* know the ProcessLogs.

            In my point of view, this is quite error-prone (you *have* to call the jbpmContext.save() method).
            Simply doing a session.save(ProcessLog) after the ProcessLog creation will do the trick. Hibernate will then persist the ProcessLog when it flushes its session.