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());