On Tue, Mar 24, 2009 at 7:49 AM, Anna Södling <[email protected]> wrote: > Hi, > > > I want to use some logging in my scxml-file, for example upon entering > and exiting a state. Unfortunately, I can't seem to get the hang of how > it works. I've got this line in my scxml-file: > <log label="'Renegade'" expr="'Entering state: A'"/> > > And the log output I get (in a console window in Eclipse) looks like > this: > 2009-mar-24 11:39:08 org.apache.comm > ons.scxml.model.Log execute > INFO: 'Renegade': Entering state: A > 2009-mar-24 11:39:08 org.apache.commons.scxml.model.Log execute > INFO: 'Renegade': Entering state: A > <snip/>
That seems OK to me (other than the fact it appeared twice, probably a cut-n-paste error?). > Also, I'm doing some ordinary printed outputs (in Java) while I'm > running my state machine, and the log info is not placed on the right > place among these outputs either, but before all of them (so it doesn't > show up when I'm actually entering the state). > And that's not really what I wanted. I would simply like to have an > output that says "'Renegade': Entering state: A" (or something similar) > when I'm actually entering state A. Is this possible? Or have I > missunderstood how the <log>-tag works? > <snap/> Please say more about the Java code which contains these print statements. Are you using an AbstractStateMachine subclass, an SCXMLListener or something else? (<onentry> content in the SCXML document executes before code in both those specific cases). If you want more fine-grained control about the timing of your procedural code within state changes (or sequencing even within a particular <onentry> or <onexit>), that kind of thing can be achieved by using custom actions [1] to call your code from the appropriate place(s) in SCXML executable content. -Rahul [1] http://commons.apache.org/scxml/guide/custom-actions.html > Sincerely, > Anna > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
