3 Replies Latest reply on Sep 22, 2015 10:07 AM by Vibhu Bhutani

    JBPM Audit Log issue in 6.0.1-Final

    Vibhu Bhutani Newbie

      Am trying to disable the audit log in jbpm 6.0.1-Final. Below is few code sniplets:

       

      CustomLogFactory customLogFactory = new CustomLogFactory();
        entityManagerFactory = Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa");
        final RuntimeEnvironmentBuilder builder = RuntimeEnvironmentBuilder.Factory.get()
        .newDefaultBuilder().entityManagerFactory(entityManagerFactory)
        .registerableItemsFactory(customLogFactory)
        .knowledgeBase(kbase);
      
              
        runtimeEnvironment = builder.get();
        final RuntimeManagerFactory factory = RuntimeManagerFactory.Factory.get();
        RuntimeManager runtimeManager = factory.newSingletonRuntimeManager(runtimeEnvironment, "com.test-1.0");
        return runtimeManager;
      

       

       

       

      public class CustomLogFactory extends DefaultRegisterableItemsFactory {
        Boolean historyEnabled = false;
      @Override
          public List<ProcessEventListener> getProcessEventListeners(RuntimeEngine runtime) {
              List<ProcessEventListener> defaultListeners = new ArrayList<ProcessEventListener>();
              // register JPAWorkingMemoryDBLogger
             if(historyEnabled){
                  AbstractAuditLogger logger = AuditLoggerFactory.newJPAInstance(runtime.getKieSession().getEnvironment());
                  logger.setBuilder(getAuditBuilder(runtime));
                  defaultListeners.add(logger);
              }
              // add any custom listeners
              defaultListeners.addAll(super.getProcessEventListeners(runtime));
              return defaultListeners;
          }
      
      
      }
      

       

       

      The audit log is not getting disabled. Its still logging all the database entries. I wanted to see what is the performance overhead that Audit Logs are putting on my jbpm syste

        • 1. Re: JBPM Audit Log issue in 6.0.1-Final
          Vibhu Bhutani Newbie

          Any body?? Can some one help?

          • 2. Re: JBPM Audit Log issue in 6.0.1-Final
            Abhijit Humbe Master

            Try extending SimpleRegisterableItemsFactory class.

             

            historyEnabled = false;

            public class CustomLogFactory extends SimpleRegisterableItemsFactory {

            ..

            @Override

             

                public List<ProcessEventListener> getProcessEventListeners(RuntimeEngine runtime) {

                    List<ProcessEventListener> defaultListeners = new ArrayList<ProcessEventListener>();

                    // register JPAWorkingMemoryDBLogger

                   if(historyEnabled){

                        AbstractAuditLogger logger = AuditLoggerFactory.newJPAInstance(runtime.getKieSession().getEnvironment());

                        logger.setBuilder(getAuditBuilder(runtime));

                        defaultListeners.add(logger);

                    }

                    // add any custom listeners

                    defaultListeners.addAll(super.getProcessEventListeners(runtime));

                    return defaultListeners;

                }

            ..

            }

             

            and registered this class object to environment.

             

            CustomLogFactory logFactory = new CustomLogFactory();

            environment = RuntimeEnvironmentBuilder.Factory.get()

                                .newDefaultBuilder()

                                .entityManagerFactory(Persistence.createEntityManagerFactory(Benchmark.persistenceUnit))

                                .userGroupCallback(new JBossUserGroupCallbackImpl("classpath:/usergroup.properties"))

                                .registerableItemsFactory(logFactory)

                                .addAsset(ResourceFactory.newClassPathResource("process01.bpmn20.xml"), ResourceType.BPMN2)

                                .get();

            • 3. Re: JBPM Audit Log issue in 6.0.1-Final
              Vibhu Bhutani Newbie

              I removed following line from CustomLogFactory and it worked.

               

              1. public class CustomLogFactory extends DefaultRegisterableItemsFactory { 
              2.   Boolean historyEnabled = false
              3. @Override 
              4.     public List<ProcessEventListener> getProcessEventListeners(RuntimeEngine runtime) { 
              5.         List<ProcessEventListener> defaultListeners = new ArrayList<ProcessEventListener>(); 
              6.         // register JPAWorkingMemoryDBLogger 
              7.        if(historyEnabled){ 
              8.             AbstractAuditLogger logger = AuditLoggerFactory.newJPAInstance(runtime.getKieSession().getEnvironment()); 
              9.             logger.setBuilder(getAuditBuilder(runtime)); 
              10.             defaultListeners.add(logger); 
              11.         } 
              12.         // add any custom listeners 
              13.        defaultListeners.addAll(super.getProcessEventListeners(runtime)); 
              14.         return defaultListeners; 
              15.     } 
              16.  
              17.