str += "then\n";
str += " list.add( 1 );\n";
str += "end\n";
str += "\n";
KieServices ks = KieServices.Factory.get();
KieFactory kf = KieFactory.Factory.get();
KieFileSystem kfs = kf.newKieFileSystem().write( "src/main/resources/r1.drl", str );
ks.newKieBuilder( kfs ).build();
KieBase kbase = ks.getKieContainer(ks.getKieRepository().getDefaultGAV()).getKieBase();
KieSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, null, env );
SingleSessionCommandService sscs = (SingleSessionCommandService)
((CommandBasedStatefulKnowledgeSession) ksession).getCommandService();
sscs.addInterceptor(new LoggingInterceptor());