You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Nestor Urquiza <ne...@yahoo.com> on 2006/11/01 18:38:01 UTC

[SCXML] enabling/disabling logging for var assignments

Hi guys,

I am using a custom log library for my Bridge and
System layers. 

When I want to log transitions and onentry/onexit
events I can do it thru the SCXMLListener
implementation. 

However for var assignments and evaluations I would
like to know the easier way to log them.

Right now with more than 2000 lines of scxml I really
need to trace every single assignment within the code.

Also does anyone know about a plan to build an SCXML
debugger? Now that I have all the Controller logic
written in SCXML I really need that and before
writting any code I would like to hear some advice.

Thanks,

-Nestor


 
____________________________________________________________________________________
Access over 1 million songs - Yahoo! Music Unlimited 
(http://music.yahoo.com/unlimited)


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] enabling/disabling logging for var assignments

Posted by Rahul Akolkar <ra...@gmail.com>.
On 11/1/06, Nestor Urquiza <ne...@yahoo.com> wrote:
> I will as soon as I solve another issue I am having
> ... my code broke after tried to use either the
> release jar file or the current svn code.
>
> I will open another thread with the specific issue,
>
<snip/>

OK. Note that SVN code requires the SCXML namespace to match (case sensitive):

http://www.w3.org/2005/07/scxml

-Rahul


> Thanks,
>
> -nestor
>
> --- Rahul Akolkar <ra...@gmail.com> wrote:
>
> > On 11/1/06, Nestor Urquiza <ne...@yahoo.com>
> > wrote:
> > > Hi guys,
> > >
> > > I am using a custom log library for my Bridge and
> > > System layers.
> > >
> > > When I want to log transitions and onentry/onexit
> > > events I can do it thru the SCXMLListener
> > > implementation.
> > >
> > > However for var assignments and evaluations I
> > would
> > > like to know the easier way to log them.
> > >
> > > Right now with more than 2000 lines of scxml I
> > really
> > > need to trace every single assignment within the
> > code.
> > >
> > > Also does anyone know about a plan to build an
> > SCXML
> > > debugger? Now that I have all the Controller logic
> > > written in SCXML I really need that and before
> > > writting any code I would like to hear some
> > advice.
> > >
> > <snip/>
> >
> > The easiest way would be to add logging statements
> > in
> >
> > org.apache.commons.scxml.model.Var#execute(...)
> >
> > and
> >
> > org.apache.commons.scxml.model.Assign#execute(...)
> >
> > right at the point where any Context operation --
> > such as
> > Context#set(...) -- is called. That way, it could
> > simply be turned
> > on/off with the JCL configuration. Should be useful
> > as long as the log
> > level is correct (probably, trace would be
> > appropriate).
> >
> > If you do this for yourself, can you please submit a
> > patch (svn diff)?
> >
> > -Rahul
> >
> >
> > > Thanks,
> > >
> > > -Nestor
> > >
> > >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] enabling/disabling logging for var assignments

Posted by Nestor Urquiza <ne...@yahoo.com>.
Done[1]
Thank you!,

-Nestor

[1] https://issues.apache.org/jira/browse/SCXML-40

--- Rahul Akolkar <ra...@gmail.com> wrote:

> On 3/26/07, Nestor Urquiza <ne...@yahoo.com>
> wrote:
> > Hi Rahul,
> >
> > In a concurrent environment like a web application
> it
> > is of a tremendous important to get the Session Id
> > together with any log trace.
> >
> > I am not sure how this requirement fits in the
> actual
> > model but I would say that given the fact an
> executor
> > defines uniquely a State Machine status at any
> time it
> > is the executor the one that ideally should carry
> an
> > identifier.
> >
> > I would allow that identifier to be accessible
> with
> > getter/setter methods. That way one can decide to
> set
> > the exec#id with the session Id and later that
> memeber
> > could be used to be output as part of the current
> var,
> > assign traces.
> >
> <snip/>
> 
> Makes sense, can imagine it will make mining easier.
> Could you open an
> enhancement request in the Commons SCXML issue
> tracker [1]? Thanks.
> 
> 
> > Also as another suggestion I used for the traces
> for
> > my personal solution something like:
> > Var.baseServiceUrlWAP=
> >
>
Assign.baseServiceUrlWAP=http://usa-apptest.buongiorno.com/waptools/
> >
> > I see in the commons-scxml release is used:
> > <var>: Defined variable 'baseServiceUrlWAP' with
> > initial value ''
> > <assign>: Set variable 'baseServiceUrlWAP' to
> > 'http://usa-apptest.buongiorno.com/waptools/'
> >
> > I see the first one less verbose and still saying
> the
> > same.
> >
> <snap/>
> 
> Yes, but this is so subjective that its perhaps best
> to not change
> anything at all. The brevity of the suggested log
> format comes at the
> expense of being able to get the hang of the
> pseudo-language in there
> (not that its hard to understand).
> 
> -Rahul
> 
> [1]
>
http://jakarta.apache.org/commons/scxml/issue-tracking.html
> 
> 
> > Thanks!
> >
> > -Nestor
> >
> >
> >
> > --- Rahul Akolkar <ra...@gmail.com> wrote:
> >
> > > On 11/17/06, Nestor Urquiza <ne...@yahoo.com>
> > > wrote:
> > > > Logging Tutorial created [1]
> > > > JIRA issue including the proposed patch [2]
> > > >
> > > <snip/>
> > >
> > > Thanks, I've marked the issue against 0.6 so it
> > > should be in the next release.
> > >
> > > -Rahul
> > >
> > >
> > > > Thanks
> > > >
> > > > -Nestor
> > > >
> > > > [1]
> > > >
> > >
> >
>
http://wiki.apache.org/jakarta-commons/SCXML/Tutorials/Logging#preview
> > > > [2]
> https://issues.apache.org/jira/browse/SCXML-31
> > > >
> > >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> 
> 



 
____________________________________________________________________________________
Bored stiff? Loosen up... 
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] enabling/disabling logging for var assignments

Posted by Rahul Akolkar <ra...@gmail.com>.
On 3/26/07, Nestor Urquiza <ne...@yahoo.com> wrote:
> Hi Rahul,
>
> In a concurrent environment like a web application it
> is of a tremendous important to get the Session Id
> together with any log trace.
>
> I am not sure how this requirement fits in the actual
> model but I would say that given the fact an executor
> defines uniquely a State Machine status at any time it
> is the executor the one that ideally should carry an
> identifier.
>
> I would allow that identifier to be accessible with
> getter/setter methods. That way one can decide to set
> the exec#id with the session Id and later that memeber
> could be used to be output as part of the current var,
> assign traces.
>
<snip/>

Makes sense, can imagine it will make mining easier. Could you open an
enhancement request in the Commons SCXML issue tracker [1]? Thanks.


> Also as another suggestion I used for the traces for
> my personal solution something like:
> Var.baseServiceUrlWAP=
> Assign.baseServiceUrlWAP=http://usa-apptest.buongiorno.com/waptools/
>
> I see in the commons-scxml release is used:
> <var>: Defined variable 'baseServiceUrlWAP' with
> initial value ''
> <assign>: Set variable 'baseServiceUrlWAP' to
> 'http://usa-apptest.buongiorno.com/waptools/'
>
> I see the first one less verbose and still saying the
> same.
>
<snap/>

Yes, but this is so subjective that its perhaps best to not change
anything at all. The brevity of the suggested log format comes at the
expense of being able to get the hang of the pseudo-language in there
(not that its hard to understand).

-Rahul

[1] http://jakarta.apache.org/commons/scxml/issue-tracking.html


> Thanks!
>
> -Nestor
>
>
>
> --- Rahul Akolkar <ra...@gmail.com> wrote:
>
> > On 11/17/06, Nestor Urquiza <ne...@yahoo.com>
> > wrote:
> > > Logging Tutorial created [1]
> > > JIRA issue including the proposed patch [2]
> > >
> > <snip/>
> >
> > Thanks, I've marked the issue against 0.6 so it
> > should be in the next release.
> >
> > -Rahul
> >
> >
> > > Thanks
> > >
> > > -Nestor
> > >
> > > [1]
> > >
> >
> http://wiki.apache.org/jakarta-commons/SCXML/Tutorials/Logging#preview
> > > [2] https://issues.apache.org/jira/browse/SCXML-31
> > >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Thread usage in Commons SCXML

Posted by Rahul Akolkar <ra...@gmail.com>.
Please prefix email subjects with [SCXML], this is probably OK now
since it would be somewhat redundant :-)

On 3/27/07, Elam Birnbaum (ebirnbau) <eb...@cisco.com> wrote:
> Hello,
>
> While we are on the subject of threads and concurrency, I would like to
> ask if Commons SCXML itself spawns off threads and if so when and it is
> possible to give the user control over that.
>
<snip/>

Commons SCXML has many usecases in web / application server
environments and is extra careful about not spawning threads (unless
the developer makes specific choices -- see below). The short answer
is no. Everything with respect to threads is in the user's control.


> I know from a previous e-mail thread I started that the proper way to
> trigger events on the state engine is via another thread and that is
> fine since that thread spawning is under user control. I am more
> concerned about any threads Commons SCXML itself spawns for its own
> purposes, if any, even if they are short-lived. My system is sensitive
> to total threads spawned (my component is a small part of a bigger
> project that could all run under the same JVM) so I'd just like to be
> aware of how Commons SCXML deals with its own threads so I am prepared.
>
<snap/>

When an SCXMLExecutor is instantiated, it is not equipped to spawn
threads at all. However, the specification requires certain things
like:

1) Invoking external processes in an unrelated context
2) Introducing a delay before some event is sent

For (1), the user registers invoker classes for each targettype with
the executor. An example is SimpleSCXMLInvoker (which invokes a SCXML
document in its own context by spawning a thread) but the user has to
actively make the decision to use it (by registering this invoker for
targettype "scxml")

For (2), the user registers an EventDispatcher with the executor that
is capable of processing delays. An example is provided
(SimpleScheduler) that uses J2SE Timers, but again the user has to
actively make the decision to register this dispatcher.

-Rahul


> Thanks,
>
> Elam Birnbaum
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Thread usage in Commons SCXML

Posted by "Elam Birnbaum (ebirnbau)" <eb...@cisco.com>.
Hello,

While we are on the subject of threads and concurrency, I would like to
ask if Commons SCXML itself spawns off threads and if so when and it is
possible to give the user control over that. 

I know from a previous e-mail thread I started that the proper way to
trigger events on the state engine is via another thread and that is
fine since that thread spawning is under user control. I am more
concerned about any threads Commons SCXML itself spawns for its own
purposes, if any, even if they are short-lived. My system is sensitive
to total threads spawned (my component is a small part of a bigger
project that could all run under the same JVM) so I'd just like to be
aware of how Commons SCXML deals with its own threads so I am prepared.

Thanks,

Elam Birnbaum

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] enabling/disabling logging for var assignments

Posted by Nestor Urquiza <ne...@yahoo.com>.
Hi Rahul,

In a concurrent environment like a web application it
is of a tremendous important to get the Session Id
together with any log trace.

I am not sure how this requirement fits in the actual
model but I would say that given the fact an executor
defines uniquely a State Machine status at any time it
is the executor the one that ideally should carry an
identifier. 

I would allow that identifier to be accessible with
getter/setter methods. That way one can decide to set
the exec#id with the session Id and later that memeber
could be used to be output as part of the current var,
assign traces.

Also as another suggestion I used for the traces for
my personal solution something like:
Var.baseServiceUrlWAP=
Assign.baseServiceUrlWAP=http://usa-apptest.buongiorno.com/waptools/

I see in the commons-scxml release is used:
<var>: Defined variable 'baseServiceUrlWAP' with
initial value ''
<assign>: Set variable 'baseServiceUrlWAP' to
'http://usa-apptest.buongiorno.com/waptools/'

I see the first one less verbose and still saying the
same.

Thanks!

-Nestor



--- Rahul Akolkar <ra...@gmail.com> wrote:

> On 11/17/06, Nestor Urquiza <ne...@yahoo.com>
> wrote:
> > Logging Tutorial created [1]
> > JIRA issue including the proposed patch [2]
> >
> <snip/>
> 
> Thanks, I've marked the issue against 0.6 so it
> should be in the next release.
> 
> -Rahul
> 
> 
> > Thanks
> >
> > -Nestor
> >
> > [1]
> >
>
http://wiki.apache.org/jakarta-commons/SCXML/Tutorials/Logging#preview
> > [2] https://issues.apache.org/jira/browse/SCXML-31
> >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> 
> 



 
____________________________________________________________________________________
Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] enabling/disabling logging for var assignments

Posted by Rahul Akolkar <ra...@gmail.com>.
On 11/17/06, Nestor Urquiza <ne...@yahoo.com> wrote:
> Logging Tutorial created [1]
> JIRA issue including the proposed patch [2]
>
<snip/>

Thanks, I've marked the issue against 0.6 so it should be in the next release.

-Rahul


> Thanks
>
> -Nestor
>
> [1]
> http://wiki.apache.org/jakarta-commons/SCXML/Tutorials/Logging#preview
> [2] https://issues.apache.org/jira/browse/SCXML-31
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] enabling/disabling logging for var assignments

Posted by Nestor Urquiza <ne...@yahoo.com>.
Logging Tutorial created [1]
JIRA issue including the proposed patch [2]

Thanks

-Nestor

[1]
http://wiki.apache.org/jakarta-commons/SCXML/Tutorials/Logging#preview
[2] https://issues.apache.org/jira/browse/SCXML-31

--- Rahul Akolkar <ra...@gmail.com> wrote:

> On 11/17/06, Nestor Urquiza <ne...@yahoo.com>
> wrote:
> >
> > --- Rahul Akolkar <ra...@gmail.com> wrote:
> >
> > > On 11/16/06, Nestor Urquiza <ne...@yahoo.com>
> > > wrote:
> > > > Since it took me a while to learn about the
> > > > commons-logging wrapper and current log
> engines I
> > > will
> > > > post here my results just in case someone has
> a
> > > > similar problem in the future:
> > > >
> > > <snip-sample-code/>
> > >
> > > Thanks for posting for the archives. I prefer
> the
> > > properties files for
> > > quick configuration. See log4j manual [1] for
> > > details. Please feel
> > > free to post any of this on the Commons SCXML
> wiki.
> > >
> >
> > Yes property or xml both are aditional files for
> the
> > package I am building, and since I am forced to
> use a
> > propietary logging package I did not want to add
> more
> > resources ... that is why I went for setting
> > programmatically Log4J.
> >
> > Do you have a suggestion for "where to post this
> > specific logging configuration on WIKI?"
> >
> <snip/>
> 
> Post it wherever you like ;-) (as long as its in the
> Commons SCXML space).
> 
> If I were doing it, I'd probably post it as a link
> it from the
> tutorials section on the HomePage [1], say as
> '../Tutorials/Logging'
> 
> 
> > >
> > > The Tracer is meant to be a one-stop shop for
> basic
> > > examples -- it
> > > provides a dummy impl (that logs callbacks) for
> most
> > > interfaces that
> > > one needs while dealing with the Commons SCXML
> APIs.
> > >
> > > The warning() method comes from the SAX
> ErrorHandler
> > > and is really
> > > orthogonal to logging. Its probably best to
> stick
> > > with JCL the way its
> > > currently done.
> >
> > Thanks for the explanation, I need then to log to
> a
> > separate scxml logging file the SCXML bits.
> >
> > Do you have a suggestion about a syntax for
> logging
> > the information from the bits? Just as a reminder
> I
> > used this in my code:
> >
> > String msg = "Var." + name + "=" + varStr;
> > if( appLog.isInfoEnabled() )
> >            appLog.info( msg );
> >
> <snap/>
> 
> If you want, you can open a JIRA issue [2] and
> optionally attach a
> patch [3] so we don't forget to get this logging bit
> in the codebase
> (and the next release).
> 
> -Rahul
> 
> [1]
>
http://wiki.apache.org/jakarta-commons/SCXML/HomePage
> [2] http://issues.apache.org/jira/browse/SCXML
> [3] http://jakarta.apache.org/commons/patches.html
> 
> 
> > -Nestor
> >
> > >
> > > -Rahul
> > >
> > > [1]
> http://logging.apache.org/log4j/docs/manual.html
> > >
> > >
> > > > Maybe PathResolverHolder is the place to
> specify a
> > > > method trace() that could be generically
> > > implemented
> > > > by an abstract class from where finally the
> data
> > > model
> > > > bits would inherit. maybe the best way is just
> to
> > > > separately define the trace() method for those
> > > bits we
> > > > are interested in.
> > > >
> > > > Bottom line the idea of having a trace of what
> is
> > > > going on and my failure to make the whole
> system
> > > log
> > > > into a unique file made me think about this
> > > > alternative which maybe is even better than
> just
> > > > logging.
> > > >
> > > > Thanks,
> > > >
> > > > -Nestor
> > > >
> > > <snip/>
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> 
> 



 
____________________________________________________________________________________
Sponsored Link

Mortgage rates near 39yr lows. 
$420k for $1,399/mo. Calculate new payment! 
www.LowerMyBills.com/lre

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] enabling/disabling logging for var assignments

Posted by Rahul Akolkar <ra...@gmail.com>.
On 11/17/06, Nestor Urquiza <ne...@yahoo.com> wrote:
>
> --- Rahul Akolkar <ra...@gmail.com> wrote:
>
> > On 11/16/06, Nestor Urquiza <ne...@yahoo.com>
> > wrote:
> > > Since it took me a while to learn about the
> > > commons-logging wrapper and current log engines I
> > will
> > > post here my results just in case someone has a
> > > similar problem in the future:
> > >
> > <snip-sample-code/>
> >
> > Thanks for posting for the archives. I prefer the
> > properties files for
> > quick configuration. See log4j manual [1] for
> > details. Please feel
> > free to post any of this on the Commons SCXML wiki.
> >
>
> Yes property or xml both are aditional files for the
> package I am building, and since I am forced to use a
> propietary logging package I did not want to add more
> resources ... that is why I went for setting
> programmatically Log4J.
>
> Do you have a suggestion for "where to post this
> specific logging configuration on WIKI?"
>
<snip/>

Post it wherever you like ;-) (as long as its in the Commons SCXML space).

If I were doing it, I'd probably post it as a link it from the
tutorials section on the HomePage [1], say as '../Tutorials/Logging'


> >
> > The Tracer is meant to be a one-stop shop for basic
> > examples -- it
> > provides a dummy impl (that logs callbacks) for most
> > interfaces that
> > one needs while dealing with the Commons SCXML APIs.
> >
> > The warning() method comes from the SAX ErrorHandler
> > and is really
> > orthogonal to logging. Its probably best to stick
> > with JCL the way its
> > currently done.
>
> Thanks for the explanation, I need then to log to a
> separate scxml logging file the SCXML bits.
>
> Do you have a suggestion about a syntax for logging
> the information from the bits? Just as a reminder I
> used this in my code:
>
> String msg = "Var." + name + "=" + varStr;
> if( appLog.isInfoEnabled() )
>            appLog.info( msg );
>
<snap/>

If you want, you can open a JIRA issue [2] and optionally attach a
patch [3] so we don't forget to get this logging bit in the codebase
(and the next release).

-Rahul

[1] http://wiki.apache.org/jakarta-commons/SCXML/HomePage
[2] http://issues.apache.org/jira/browse/SCXML
[3] http://jakarta.apache.org/commons/patches.html


> -Nestor
>
> >
> > -Rahul
> >
> > [1] http://logging.apache.org/log4j/docs/manual.html
> >
> >
> > > Maybe PathResolverHolder is the place to specify a
> > > method trace() that could be generically
> > implemented
> > > by an abstract class from where finally the data
> > model
> > > bits would inherit. maybe the best way is just to
> > > separately define the trace() method for those
> > bits we
> > > are interested in.
> > >
> > > Bottom line the idea of having a trace of what is
> > > going on and my failure to make the whole system
> > log
> > > into a unique file made me think about this
> > > alternative which maybe is even better than just
> > > logging.
> > >
> > > Thanks,
> > >
> > > -Nestor
> > >
> > <snip/>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] enabling/disabling logging for var assignments

Posted by Nestor Urquiza <ne...@yahoo.com>.
--- Rahul Akolkar <ra...@gmail.com> wrote:

> On 11/16/06, Nestor Urquiza <ne...@yahoo.com>
> wrote:
> > Since it took me a while to learn about the
> > commons-logging wrapper and current log engines I
> will
> > post here my results just in case someone has a
> > similar problem in the future:
> >
> <snip-sample-code/>
> 
> Thanks for posting for the archives. I prefer the
> properties files for
> quick configuration. See log4j manual [1] for
> details. Please feel
> free to post any of this on the Commons SCXML wiki.
> 

Yes property or xml both are aditional files for the
package I am building, and since I am forced to use a
propietary logging package I did not want to add more
resources ... that is why I went for setting
programmatically Log4J.

Do you have a suggestion for "where to post this
specific logging configuration on WIKI?"

> 
> > questions/ideas:
> > ---------------
> > Wouldn't be better to include in both the tracert
> that
> > implements SCXMLListener and the SCXMLListener
> itself
> > a notification mechanism? We already have
> > SCXMLListener#warning(), what about having
> > SCXMLListener#trace()? That way we could trace
> what is
> > happenning with most of the classes member of
> > org.apache.commons.scxml.model which means we are
> able
> > to track down what is happenning with the data
> model
> > part.
> >
> <snap/>
> 
> The Tracer is meant to be a one-stop shop for basic
> examples -- it
> provides a dummy impl (that logs callbacks) for most
> interfaces that
> one needs while dealing with the Commons SCXML APIs.
> 
> The warning() method comes from the SAX ErrorHandler
> and is really
> orthogonal to logging. Its probably best to stick
> with JCL the way its
> currently done.

Thanks for the explanation, I need then to log to a
separate scxml logging file the SCXML bits. 

Do you have a suggestion about a syntax for logging
the information from the bits? Just as a reminder I
used this in my code:

String msg = "Var." + name + "=" + varStr;
if( appLog.isInfoEnabled() )
           appLog.info( msg );

-Nestor

> 
> -Rahul
> 
> [1] http://logging.apache.org/log4j/docs/manual.html
> 
> 
> > Maybe PathResolverHolder is the place to specify a
> > method trace() that could be generically
> implemented
> > by an abstract class from where finally the data
> model
> > bits would inherit. maybe the best way is just to
> > separately define the trace() method for those
> bits we
> > are interested in.
> >
> > Bottom line the idea of having a trace of what is
> > going on and my failure to make the whole system
> log
> > into a unique file made me think about this
> > alternative which maybe is even better than just
> > logging.
> >
> > Thanks,
> >
> > -Nestor
> >
> <snip/>
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> 
> 



 
____________________________________________________________________________________
Sponsored Link

Mortgage rates near 39yr lows. 
$510k for $1,698/mo. Calculate new payment! 
www.LowerMyBills.com/lre

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] enabling/disabling logging for var assignments

Posted by Rahul Akolkar <ra...@gmail.com>.
On 11/16/06, Nestor Urquiza <ne...@yahoo.com> wrote:
> Since it took me a while to learn about the
> commons-logging wrapper and current log engines I will
> post here my results just in case someone has a
> similar problem in the future:
>
<snip-sample-code/>

Thanks for posting for the archives. I prefer the properties files for
quick configuration. See log4j manual [1] for details. Please feel
free to post any of this on the Commons SCXML wiki.


> questions/ideas:
> ---------------
> Wouldn't be better to include in both the tracert that
> implements SCXMLListener and the SCXMLListener itself
> a notification mechanism? We already have
> SCXMLListener#warning(), what about having
> SCXMLListener#trace()? That way we could trace what is
> happenning with most of the classes member of
> org.apache.commons.scxml.model which means we are able
> to track down what is happenning with the data model
> part.
>
<snap/>

The Tracer is meant to be a one-stop shop for basic examples -- it
provides a dummy impl (that logs callbacks) for most interfaces that
one needs while dealing with the Commons SCXML APIs.

The warning() method comes from the SAX ErrorHandler and is really
orthogonal to logging. Its probably best to stick with JCL the way its
currently done.

-Rahul

[1] http://logging.apache.org/log4j/docs/manual.html


> Maybe PathResolverHolder is the place to specify a
> method trace() that could be generically implemented
> by an abstract class from where finally the data model
> bits would inherit. maybe the best way is just to
> separately define the trace() method for those bits we
> are interested in.
>
> Bottom line the idea of having a trace of what is
> going on and my failure to make the whole system log
> into a unique file made me think about this
> alternative which maybe is even better than just
> logging.
>
> Thanks,
>
> -Nestor
>
<snip/>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] enabling/disabling logging for var assignments

Posted by Nestor Urquiza <ne...@yahoo.com>.
Since it took me a while to learn about the
commons-logging wrapper and current log engines I will
post here my results just in case someone has a
similar problem in the future:

problem:
-------
You are using SCXML which in turns uses
commons-logging but your code cannot use
commons-logging.

solution:
--------
You need to initialize one of the supported by
commons-logging engines like Log4J.

implementation:
----------------
I did not want to include a new resource into my
project (you can use properties file or xml file for
Log4J configuration), so I opted to configure
programmatically:

<code>
                logger =
LogManager.exists("scxml.app.log");
                if (logger == null)
                {
                    Logger logger =
Logger.getLogger("scxml.app.log");

                    // Prepare log engine for
commons-scxml
                    // We need to provide
commons-scxml package with a standard
		    //By default do not log anything that uses
commons-logging
                    Logger rootLogger =
Logger.getRootLogger();
                    SimpleLayout rootLayout = new
SimpleLayout();
                    Appender rootAppender = new
ConsoleAppender();
                   
rootLogger.addAppender(rootAppender);
                    rootLogger.setLevel(Level.OFF);

		    //Specific layout pattern for custom application
                    String pattern = "%d{yyyy/MM/dd
HH:mm:ss.SSS} @ "
                            + Constants.LOG_HINT + " @
SCXML Engine @ %m%n";
                    PatternLayout layout = new
PatternLayout(pattern);
                    boolean append = true;
                    boolean bufferedIO = false;
                    int bufferSize = 10;
                    String filename =
"completePathOfYourFileNameAddingTimestampToNameForExample.log";
                    if
(logger.getAppender("scxml.app.appdr") == null)
                    {
                        // WriterAppender appdr =
null;
                        FileAppender appdr = null;

                        try
                        {
                            appdr = new
FileAppender(layout, filename, append,
                                    bufferedIO,
bufferSize);
                           
appdr.setImmediateFlush(true);
                           
appdr.setName("scxml.app.appdr");
                        }
                        catch (IOException e)
                        {
                            //deal with it.
                        }
                        logger.addAppender(appdr);
                        logger.setLevel(Level.INFO);
                        logger.setAdditivity(false);
                    }
                }
</code>

With the code above I was able to obtain then the
infor messages from Var and Assign needed to debug my
project (Using last version of commons-logging -1.1-
and Log4J -1.2.14- the TRACE comes up like a DEBUG
message so I decided to use INFO intead):

For Var:
<code>
String msg = "Var." + name + "=" + varStr;
        if( appLog.isInfoEnabled() )
           appLog.info( msg );
</code>

still some problems:
-------------------
If I log into the same file as my main System layer I
get some flushing problems resulting in trace lines
that are not in the output. There are several posts
related to this issue but I simply could not get rid
of the problem so I decided to log in a separate file.

questions/ideas:
---------------
Wouldn't be better to include in both the tracert that
implements SCXMLListener and the SCXMLListener itself
a notification mechanism? We already have
SCXMLListener#warning(), what about having
SCXMLListener#trace()? That way we could trace what is
happenning with most of the classes member of
org.apache.commons.scxml.model which means we are able
to track down what is happenning with the data model
part.

Maybe PathResolverHolder is the place to specify a
method trace() that could be generically implemented
by an abstract class from where finally the data model
bits would inherit. maybe the best way is just to
separately define the trace() method for those bits we
are interested in.

Bottom line the idea of having a trace of what is
going on and my failure to make the whole system log
into a unique file made me think about this
alternative which maybe is even better than just
logging.

Thanks,

-Nestor

--- Rahul Akolkar <ra...@gmail.com> wrote:

> On 11/12/06, Nestor Urquiza <ne...@yahoo.com>
> wrote:
> > Hi Rahul,
> > Sorry to come back that late. My code is again
> working
> > so I could follow step by step thru the code in
> the
> > SVN and finally I could follow your suggestions,
> so in
> > Var#execute() and Assign#execute()after:
> > ctx.setLocal(name, varObj);
> >
> > I added:
> > String varStr =
> varObj==null?"null":varObj.toString();
> > appLog.trace( "Var." + name + "=" + varStr );
> >
> > The question I have now is about how to configure
> > logging in SCXML. Is it done using a property
> file?
> > Just a constant? Of course I could dig into the
> code
> > but I guess I'll find out faster with some of your
> > help.
> >
> <snip/>
> 
> Commons SCXML uses Commons Logging so the best place
> to start is the
> Commons Logging 1.0.4 user guide [1], if you haven't
> looked at it
> before.
> 
> The default logical name for 'appLog' is the
> arbitrarily chosen 'scxml.app.log'.
> 
> -Rahul
> 
> [1]
>
http://jakarta.apache.org/commons/logging/commons-logging-1.0.4/docs/guide.html
> 
> 
> > Thanks,
> >
> > -Nestor
> >
> >
> >
> >
> >
> >
> > --- Rahul Akolkar <ra...@gmail.com> wrote:
> >
> > > On 11/1/06, Nestor Urquiza <ne...@yahoo.com>
> > > wrote:
> > > > Hi guys,
> > > >
> > > > I am using a custom log library for my Bridge
> and
> > > > System layers.
> > > >
> > > > When I want to log transitions and
> onentry/onexit
> > > > events I can do it thru the SCXMLListener
> > > > implementation.
> > > >
> > > > However for var assignments and evaluations I
> > > would
> > > > like to know the easier way to log them.
> > > >
> > > > Right now with more than 2000 lines of scxml I
> > > really
> > > > need to trace every single assignment within
> the
> > > code.
> > > >
> > > > Also does anyone know about a plan to build an
> > > SCXML
> > > > debugger? Now that I have all the Controller
> logic
> > > > written in SCXML I really need that and before
> > > > writting any code I would like to hear some
> > > advice.
> > > >
> > > <snip/>
> > >
> > > The easiest way would be to add logging
> statements
> > > in
> > >
> > > org.apache.commons.scxml.model.Var#execute(...)
> > >
> > > and
> > >
> > >
> org.apache.commons.scxml.model.Assign#execute(...)
> > >
> > > right at the point where any Context operation
> --
> > > such as
> > > Context#set(...) -- is called. That way, it
> could
> > > simply be turned
> > > on/off with the JCL configuration. Should be
> useful
> > > as long as the log
> > > level is correct (probably, trace would be
> > > appropriate).
> > >
> > > If you do this for yourself, can you please
> submit a
> > > patch (svn diff)?
> > >
> > > -Rahul
> > >
> > >
> > > > Thanks,
> > > >
> > > > -Nestor
> > > >
> > > >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> 
> 



 
____________________________________________________________________________________
Sponsored Link

Online degrees - find the right program to advance your career.
Www.nextag.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] enabling/disabling logging for var assignments

Posted by Rahul Akolkar <ra...@gmail.com>.
On 11/12/06, Nestor Urquiza <ne...@yahoo.com> wrote:
> Hi Rahul,
> Sorry to come back that late. My code is again working
> so I could follow step by step thru the code in the
> SVN and finally I could follow your suggestions, so in
> Var#execute() and Assign#execute()after:
> ctx.setLocal(name, varObj);
>
> I added:
> String varStr = varObj==null?"null":varObj.toString();
> appLog.trace( "Var." + name + "=" + varStr );
>
> The question I have now is about how to configure
> logging in SCXML. Is it done using a property file?
> Just a constant? Of course I could dig into the code
> but I guess I'll find out faster with some of your
> help.
>
<snip/>

Commons SCXML uses Commons Logging so the best place to start is the
Commons Logging 1.0.4 user guide [1], if you haven't looked at it
before.

The default logical name for 'appLog' is the arbitrarily chosen 'scxml.app.log'.

-Rahul

[1] http://jakarta.apache.org/commons/logging/commons-logging-1.0.4/docs/guide.html


> Thanks,
>
> -Nestor
>
>
>
>
>
>
> --- Rahul Akolkar <ra...@gmail.com> wrote:
>
> > On 11/1/06, Nestor Urquiza <ne...@yahoo.com>
> > wrote:
> > > Hi guys,
> > >
> > > I am using a custom log library for my Bridge and
> > > System layers.
> > >
> > > When I want to log transitions and onentry/onexit
> > > events I can do it thru the SCXMLListener
> > > implementation.
> > >
> > > However for var assignments and evaluations I
> > would
> > > like to know the easier way to log them.
> > >
> > > Right now with more than 2000 lines of scxml I
> > really
> > > need to trace every single assignment within the
> > code.
> > >
> > > Also does anyone know about a plan to build an
> > SCXML
> > > debugger? Now that I have all the Controller logic
> > > written in SCXML I really need that and before
> > > writting any code I would like to hear some
> > advice.
> > >
> > <snip/>
> >
> > The easiest way would be to add logging statements
> > in
> >
> > org.apache.commons.scxml.model.Var#execute(...)
> >
> > and
> >
> > org.apache.commons.scxml.model.Assign#execute(...)
> >
> > right at the point where any Context operation --
> > such as
> > Context#set(...) -- is called. That way, it could
> > simply be turned
> > on/off with the JCL configuration. Should be useful
> > as long as the log
> > level is correct (probably, trace would be
> > appropriate).
> >
> > If you do this for yourself, can you please submit a
> > patch (svn diff)?
> >
> > -Rahul
> >
> >
> > > Thanks,
> > >
> > > -Nestor
> > >
> > >

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] enabling/disabling logging for var assignments

Posted by Nestor Urquiza <ne...@yahoo.com>.
I will as soon as I solve another issue I am having
... my code broke after tried to use either the
release jar file or the current svn code.

I will open another thread with the specific issue,

Thanks,

-nestor

--- Rahul Akolkar <ra...@gmail.com> wrote:

> On 11/1/06, Nestor Urquiza <ne...@yahoo.com>
> wrote:
> > Hi guys,
> >
> > I am using a custom log library for my Bridge and
> > System layers.
> >
> > When I want to log transitions and onentry/onexit
> > events I can do it thru the SCXMLListener
> > implementation.
> >
> > However for var assignments and evaluations I
> would
> > like to know the easier way to log them.
> >
> > Right now with more than 2000 lines of scxml I
> really
> > need to trace every single assignment within the
> code.
> >
> > Also does anyone know about a plan to build an
> SCXML
> > debugger? Now that I have all the Controller logic
> > written in SCXML I really need that and before
> > writting any code I would like to hear some
> advice.
> >
> <snip/>
> 
> The easiest way would be to add logging statements
> in
> 
> org.apache.commons.scxml.model.Var#execute(...)
> 
> and
> 
> org.apache.commons.scxml.model.Assign#execute(...)
> 
> right at the point where any Context operation --
> such as
> Context#set(...) -- is called. That way, it could
> simply be turned
> on/off with the JCL configuration. Should be useful
> as long as the log
> level is correct (probably, trace would be
> appropriate).
> 
> If you do this for yourself, can you please submit a
> patch (svn diff)?
> 
> -Rahul
> 
> 
> > Thanks,
> >
> > -Nestor
> >
> >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> 
> 



 
____________________________________________________________________________________
Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates 
(http://voice.yahoo.com)


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] enabling/disabling logging for var assignments

Posted by Nestor Urquiza <ne...@yahoo.com>.
Hi Rahul,
Sorry to come back that late. My code is again working
so I could follow step by step thru the code in the
SVN and finally I could follow your suggestions, so in
Var#execute() and Assign#execute()after:
ctx.setLocal(name, varObj);

I added:
String varStr = varObj==null?"null":varObj.toString();
appLog.trace( "Var." + name + "=" + varStr );

The question I have now is about how to configure
logging in SCXML. Is it done using a property file?
Just a constant? Of course I could dig into the code
but I guess I'll find out faster with some of your
help.

Thanks,

-Nestor






--- Rahul Akolkar <ra...@gmail.com> wrote:

> On 11/1/06, Nestor Urquiza <ne...@yahoo.com>
> wrote:
> > Hi guys,
> >
> > I am using a custom log library for my Bridge and
> > System layers.
> >
> > When I want to log transitions and onentry/onexit
> > events I can do it thru the SCXMLListener
> > implementation.
> >
> > However for var assignments and evaluations I
> would
> > like to know the easier way to log them.
> >
> > Right now with more than 2000 lines of scxml I
> really
> > need to trace every single assignment within the
> code.
> >
> > Also does anyone know about a plan to build an
> SCXML
> > debugger? Now that I have all the Controller logic
> > written in SCXML I really need that and before
> > writting any code I would like to hear some
> advice.
> >
> <snip/>
> 
> The easiest way would be to add logging statements
> in
> 
> org.apache.commons.scxml.model.Var#execute(...)
> 
> and
> 
> org.apache.commons.scxml.model.Assign#execute(...)
> 
> right at the point where any Context operation --
> such as
> Context#set(...) -- is called. That way, it could
> simply be turned
> on/off with the JCL configuration. Should be useful
> as long as the log
> level is correct (probably, trace would be
> appropriate).
> 
> If you do this for yourself, can you please submit a
> patch (svn diff)?
> 
> -Rahul
> 
> 
> > Thanks,
> >
> > -Nestor
> >
> >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> 
> 



 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [SCXML] enabling/disabling logging for var assignments

Posted by Rahul Akolkar <ra...@gmail.com>.
On 11/1/06, Nestor Urquiza <ne...@yahoo.com> wrote:
> Hi guys,
>
> I am using a custom log library for my Bridge and
> System layers.
>
> When I want to log transitions and onentry/onexit
> events I can do it thru the SCXMLListener
> implementation.
>
> However for var assignments and evaluations I would
> like to know the easier way to log them.
>
> Right now with more than 2000 lines of scxml I really
> need to trace every single assignment within the code.
>
> Also does anyone know about a plan to build an SCXML
> debugger? Now that I have all the Controller logic
> written in SCXML I really need that and before
> writting any code I would like to hear some advice.
>
<snip/>

The easiest way would be to add logging statements in

org.apache.commons.scxml.model.Var#execute(...)

and

org.apache.commons.scxml.model.Assign#execute(...)

right at the point where any Context operation -- such as
Context#set(...) -- is called. That way, it could simply be turned
on/off with the JCL configuration. Should be useful as long as the log
level is correct (probably, trace would be appropriate).

If you do this for yourself, can you please submit a patch (svn diff)?

-Rahul


> Thanks,
>
> -Nestor
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org