> 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: > > > 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 >
That seems OK to me (other than the fact it appeared twice, probably a cut-n-paste error?). No, it was supposed to enter state A twice during the running of the state machine...though I guess I didn't really have to paste both outputs :) However, I'm wondering if there is some way to "clean up" the output? If possible, I would like to remove the "org.apache.commons.scxml.model.Log execute" and put the date and info on the same row. > 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 -tag works? > Please say more about the Java code which contains these print statements. Are you using an AbstractStateMachine subclass, an SCXMLListener or something else? ( content in the SCXML document executes before code in both those specific cases). We're using an AbstractStateMachine...we haven't extended it (since this didn't work for some reason), but rather copied it and added some parts. But it's a kind of ASM very similar to the original. We have a little problem with this line of code in the onentry-listener though: invoke(entered.getId()); Without it, we only get the original output, but when we add it, we get a whole lot of error messages. We're not sure what it is doing, or invoking? If you want more fine-grained control about the timing of your procedural code within state changes (or sequencing even within a particular or ), 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. We've tried with several log expressions, some in onentry-tags, and some not. Even though they're not shown exactly where we want to, they seem to be shown in the right order. But, is this maybe a coincidence? /Anna . <P><p><font face="Arial, Helvetica, sans-serif" size="2" style="font-size:13.5px">_______________________________________________________________<BR> </font>
