[rules-users] Rules trace questions

Anais Martinez amartinez at iti.upv.es
Wed Nov 24 06:12:07 EST 2010


Hello.

I'm trying to get the rules trace in execution by using
WorkingMemoryFileLogger. I am using the Hello word example, and I call the
WorkingMemoryFileLogger.wirteToDisk() in the RHS of rules. My modified drl
file is:

import com.sample.DroolsTest.Message;
 
global org.drools.audit.WorkingMemoryFileLogger rulesLogger

declare Output
	@role (event)
end
 
rule "Hello World"
	when
		m : Message( status == Message.HELLO, myMessage : message )
	then
		System.out.println( myMessage + ": Hello message" ); 
		m.setMessage( myMessage );
		m.setStatus( Message.GOODBYE );
		update( m );
end

rule "GoodBye"
	when
		Message( status == Message.GOODBYE, myMessage : message )
	then	
		System.out.println( myMessage + ": Goodbye message" );
		Output o= new Output();
		insert(s);
end

rule "log trace"
	when
		o:Output( )
	then
		System.out.println("Loggin trace");
		rulesLogger.writeToDisk();
end

I have filtered the logger to see only LogEvent.ACTIVATION_CREATED, and I
set the global rulesLogger in Main(). If I insert 2 messages, 2 "event.log"
files and one "test.log" appears. I have several questions (sorry if I say
nonsense):

First. How do I read the trace for each fire of "rule to log trace"? I mean,
the trace for "rule to log trace" is written forward (from event
insertion/updating/removing to "log trace" activation) or backward (from
"log trace" activation to event insertion/updating/removing)? 

Second. Each event.log appears in each "log trace" activation because I am
writing the trace in the RHS. Am I right? Can I use that in order to read
the trace for each individual activation of "log trace"?

Third. I only allow LogEvent.ACTIVATION_CREATED, but some ObjectLogEvent
appear in the test.log file, but not in the event.log files. Why? 

Thanks in advance.

-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rules-trace-questions-tp1960008p1960008.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list