Here are answers to your questions:

1) Can 'pythonloglevel' and 'pythonoutput' be modified at runtime? In 
other words, can a script override the values set in staf.cfg?

You can set the PythonLogLevel and PythonOutput settings at the STAX 
service level (when registering the STAX service), or you can override 
these settings when executing a STAX job (by specifying these options on 
the STAX EXECUTE request or in the <job> element -- the STAX Monitor let's 
you do this as well when submitting a new job for execution).

You can also change the default settings for PythonLogLevel and 
PythonOutput used by the STAX service via a STAX SET request (e.g. STAF 
local STAX SET PYTHONLOGLEVEL=Info).  However, note that changing a 
setting for the STAX service only effects any new STAX jobs, not STAX jobs 
that are already running. 

Python variables named STAXPythonOutput and STAXPythonLog level are 
provided to show you what these settings are, but they are assigned at the 
beginning of the execution of a STAX job and changing their values does 
not do anything.

So, the answer is "No", you cannot change these settings for a STAX job 
that is already running.  You cannot change them via Python code within a 
<script> element.  But you can override the setting for a STAX job when 
submitting it for execution (as I described above).

All of this information is in the STAX User's Guide at 
http://staf.sourceforge.net/current/STAX/staxug.html.  Just search on 
PythonLogLevel or PythonOutput.


2) What 'pythonloglevel' would be certain to show all messages?  Reading 
the docs, it isn't clear to me.

I don't really understand what you mean.  You can set PythonLogLevel to 
any valid STAF log level  (e.g. "Info", "User1", "Warning", etc) -- it 
defaults to "Info".  When you query the STAX Job Log, all messages in the 
log are shown by default unless you specify to only show messages with 
certain log levels in your STAF LOG QUERY request, e.g. via the LEVELMASK 
option.

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:   Tennis Smith <tennis_sm...@yahoo.com>
To:     Sharon Lucas/Austin/IBM@IBMUS
Cc:     staf-users@lists.sourceforge.net
Date:   07/21/2011 09:56 AM
Subject:        Re: [staf-users] Debugging Jython In Stax
Sent by:        tennis.n.sm...@gmail.com



Good Morning,

Got a couple questions for you.

1) Can 'pythonloglevel' and 'pythonoutput' be modified at runtime? In 
other words, can a script override the values set in staf.cfg?

2) What 'pythonloglevel' would be certain to show all messages?  Reading 
the docs, it isn't clear to me.

Thanks,
-T


On Tue, Jul 19, 2011 at 10:24 AM, Sharon Lucas <luc...@us.ibm.com> wrote:
I tried to recreate the problem but it worked fine for me.  I created a 
STAX job that called execfile to run a .py file within a <script> element. 
 The .py file's print statement appeared in the STAX Job User Log and in 
the STAX Monitor messages just like print statements that are contained 
directly within a <script> element.  If you doing something different, let 
me know.  Here's the STAX job and .py file that I ran: 

Contents of C:\stax\testScriptFile.py: 

print 'Printed by testScriptFile.py' 

Contents of C:\stax\execFile.xml: 

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<!DOCTYPE stax SYSTEM "stax.dtd"> 

<stax> 

  <defaultcall function="Main"/> 

  <function name="Main" scope="local"> 
    <sequence> 
      <script> 
        print 'Printed by script element in job' 
        execfile('C:/stax/testScriptFile.py') 
      </script> 
    </sequence> 
  </function> 
</stax> 

Here's the STAX Job Log User file output: (these message also appeared in 
the STAX Monitor's Messages panel) 

C:\>STAF local LOG QUERY MACHINE {STAF/Config/MachineNickname} LOGNAME 
STAX_Job_3_User 
Response 
-------- 
Date-Time         Level Message 
----------------- ----- --------------------------------- 
20110719-12:14:57 Info  Printed by script element in job 
20110719-12:14:57 Info  Printed by testScriptFile.py 

Here are the settings for the STAX service that show "Python Output" is 
set to "JobUserLogAndMsg": 

C:\>STAF local STAX LIST SETTINGS 
Response 
-------- 
{ 
  Event Machine         : local 
  Event Service Name    : Event 
  Number of Threads     : 5 
  Process Timeout       : 60000 
  File Caching          : Enabled 
  Max File Cache Size   : 20 
  File Cache Algorithm  : LRU 
  Max File Cache Age    : 0 
  Max Machine Cache Size: 20 
  Max Return File Size  : 0 
  Max Get Queue Messages: 25 
  Max STAX-Threads      : 0 
  Clear Logs            : Enabled 
  Log TC Elapsed Time   : Enabled 
  Log TC Num Starts     : Enabled 
  Log TC Start/Stop     : Disabled 
  Python Output         : JobUserLogAndMsg 
  Python Log Level      : Info 
  Extensions            : [] 
  Extension File        : <None> 
} 

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:        Sharon Lucas/Austin/IBM 
To:        Tennis Smith <tennis_sm...@yahoo.com> 
Cc:        staf-users@lists.sourceforge.net 
Date:        07/18/2011 04:34 PM 
Subject:        Re: [staf-users] Debugging Jython In Stax 



I'm not sure what you mean by the "jython routines".  Please provide a 
STAX job that provides an example of  printing from "jython routines".

Is the output being logged to the STAX JVM Log?  There's a link to view 
the STAX JVM Log via the STAX Job Monitor. 

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313





From:        Tennis Smith <tennis_sm...@yahoo.com> 
To:        staf-users@lists.sourceforge.net 
Date:        07/18/2011 02:41 PM 
Subject:        [staf-users] Debugging Jython In Stax 



Hi Guys, 
I have a jython file with several routines in it called from a stax xml 
file.   I think something is wrong with a string handler in the jython 
code, and would like to get some debug information about it. 

I changed the stax service definition in the staf.cfg file to the 
following: 

SERVICE STAX LIBRARY JSTAF EXECUTE 
{STAF/Config/STAFRoot}/services/stax/STAX.jar PARMS "PYTHONOUTPUT 
JobUserLogAndMsg CLEARLOGS Enabled PYTHONLOGLEVEL info" $ 

I am getting good debug data from print statements in the <script> areas 
of my XML code. *But*, I am not getting any output from "print" that is 
anywhere in the jython routines. 

How can I get the jython code to print debug data? 

-- 
Tks,
-Tennis
------------------------------------------------------------------------------

Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide.  Store less, Store more with what you own, Move data to 
the right place. Try It Now! 
http://www.accelacomm.com/jaw/sfnl/114/51427378/
_______________________________________________

staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users




-- 
Tks,
-Tennis
------------------------------------------------------------------------------
5 Ways to Improve & Secure Unified Communications
Unified Communications promises greater efficiencies for business. UC can 
improve internal communications as well as offer faster, more efficient ways
to interact with customers and streamline customer service. Learn more!
http://www.accelacomm.com/jaw/sfnl/114/51426253/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to