See section "STAX Logging" in the STAX User's Guide at 
http://staf.sourceforge.net/current/STAX/staxug.html#Header_StaxLogging 
for how to query STAX job logs using the STAF Log service.

To query a STAX job log for Job ID 45, use the following STAF log query 
machine request (assuming stax1 is the STAX service machine and STAX is 
the registered name for the service): 
STAF stax1 LOG QUERY MACHINE {STAF/Config/MachineNickname} LOGNAME 
STAX_Job_45 
An example of the output from a query of a STAX job log is: 
Response
--------
Date-Time Level  Message
--------- ------ 
--------------------------------------------------------------
20041201- Start  JobID: 45, File: c:\dev\src\stax\job1.xml, Machine: 
stax1.aust
13:43:14         in.ibm.com, Function: Main, Args: null, JobName: Job Test
20041201- Info   Holding block: main
13:43:14
20041201- Info   Received RELEASE BLOCK main request
13:43:15
20041201- Info   Releasing block: main
13:43:15
20041201- Fail   Testcase: Fail Tests, Pass: 0, Fail: 1, Last Status: 
fail, Mes
13:43:17         sage: Sub-job "Fail Test 1" could not be started.  RC: 
4001 ST
                 AFResult: Caught 
com.ibm.staf.service.stax.STAXXMLParseExcepti
                 on:  Line 7: Element type "unknown" must be declared. 
STAXResu
                 lt: None STAXSubJobID: 0
...
20041201- Stop   JobID: 45
13:43:45

Sub-section "Formatting a STAX Log as Html or Text" talks about a Java 
class, STAFLogFormatter, that you can run to format a STAX log (which is a 
binary file that has been created by the STAF Log service) as html or 
text.

For more information on the STAF Log service, see section "8.9 Log 
Service" in the STAF User's Guide at 
http://staf.sourceforge.net/current/STAFUG.htm#HDRLOGSRV.

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




From:   babmis <bab...@outlook.com>
To:     Sharon Lucas/Austin/IBM@IBMUS, 
Date:   07/29/2013 08:51 AM
Subject:        Fwd: Re: [staf-users] simple stax script




The log files STAX generates is:
/usr/local/staf/data/STAF/service/log/MACHINE/ubuntucob/GLOBAL/STAX_Job_8.log
/usr/local/staf/data/STAF/service/log/MACHINE/ubuntucob/GLOBAL/STAX_Job_8_User.log
 





example:


D^A3+¥^@Ù¼^@^@^D^@^@^@^@^C^@^@^@ 
ubuntucob^@^@^@^QSTAF/Service/STAX^@^@^@^Pnone://anonymous^@^@^@^Mlocal://local^@^@^@_JobID:
 
8, File: /root/stafexec/ping, Machine: local://local, Function: , Args: , 
JobName: <N/A>^3+¥^@Ù¼^@^@^@^B^@^@^@^C^@^@^@ 
ubuntucob^@^@^@^QSTAF/Service/STAX^@^@^@^Pnone://anonymous^@^@^@^Mlocal://local^@^@^@<98>Caught
 
com.ibm.staf.service.stax.STAXXMLParseException:

Line 23: The element type "function" must be terminated by the matching 
end-tag "</function>".^D^A3+¥^@Ù¼^@^@@^@^@^@^@^C^@^@^@ 
ubuntucob^@^@^@^QSTAF/Service/STAX^@^@^@^Pnone://anonymous^@^@^@^Mlocal://local^@^@^@+Testcasetals:
 
Tests: 0, Pass: 0, Fail: 0^D^A3+¥^@Ù¼^@^@@^@^@^@^@^C^@^@^@ 
ubuntucob^@^@^@^QSTAF/Service/STAX^@^@^@^Pnone://anonymous^@^@^@^Mlocal://local^@^@^@^PJob
 
Result: None^D^A3+¥^@Ù¼^@^@^H^@^@^@^@^C^@^@^@ 
ubun@^@^@^QSTAF/Service/STAX^@^@^@^Pnone://anonymous^@^@^@^Mlocal://local^@^@^@^HJobID:
 
8^D^A3+©^A^F<81>^@^@^D^@^@^@^@^C^@^@^@ 
ubuntucob^@^@^@^QSTAF/Service/STAX^@^@^@^Pnone://anonymous^@^@^@^Mlocal://local^@^@^@]JobID:
 
8, Fie: /root/stafexec/jm, Machine: local://local, Function: , Args: , 
JobName: <N/A>^D^A3+©^A^Fê^@^@^@^H^@^@^D<89>^@^@^@ ubuntucob^@^@^@
STAX/Job/8^@^@^@^Pnone://anonymous^@^@^@^Mlocal://local^@^@^@ Received 
HOLD BLOCK main request^D^A3+©^A^Fê^@^@^@^H^@^@^D<89>^@^@^@ 
ubuntucob^@^@^@
STAX/Job/8^@^@^@^Pnone://anonymous^@^@^@^Mlocal://local^@^@^@^SHolding 
block: main^D^A3+©^A^Fí^@^@^@^H^@^@^D<89>^@^@^@  ubuntucob^@^@^@
STAX/Job/8^@^@^@^Pnone://anonymous^@^@^@^Mlocal://local^@^@^@#Received 
RELEASE BLOCK main request^D^A3+©^A^Fí^@^@^@^H^@^@^D<89>^@^@^@ 
ubuntucob^@^@^@


Will it always comes with unreadable chars , and we need to parse ???

Thanks
-------- Original Message -------- 
Subject: 
Re: [staf-users] simple stax script
Date: 
Mon, 29 Jul 2013 19:10:32 +0530
From: 
babmis <bab...@outlook.com>
To: 
Sharon Lucas <luc...@us.ibm.com>


Thanks Sharon,
As mentioned in my previous query , Is it possible to do the same without 
opening GUI ( i mean silently or in backend writing to file etc....), so i 
can refer to the logs or the file and extract the required info . 

Is it possible??

1) what command/API Stax monitor runs internally , so that i can call the 
same command/API to do my work.
2)What stax monitor refers to present the datas.
3) Does stax monitor, monitors the "system under test" as a live user ( 
like a user does ) , or it just keep polling individual test case status??
4) Apart from test case status( in a job) monitor , what other feature 
stax monitor supports, like can it monitor system hang, core dumps, 
timeout scenarios, 
5) Can I handle all these scenarios with stax monitor.


Thanks.


On 7/29/2013 5:23 PM, Sharon Lucas wrote:
You can start the STAX Monitor via the command line as described in 
section "Starting the STAX Monitor" in the STAX User's Guide at 
http://staf.sourceforge.net/current/STAX/staxug.html#Header_StartMonitor. 
For example to start the STAX Monitor for a STAX job with job ID 1 that is 
already running, 

java -jar STAXMon.jar -job 1 

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




From:        babmis <bab...@outlook.com> 
To:        Sharon Lucas/Austin/IBM@IBMUS, 
Date:        07/28/2013 11:29 PM 
Subject:        Re: [staf-users] simple stax script 



Hi ,
Thanks for the response ,can you please tell me how do i'll call stax 
monitor with command line, i don't want to use the the GUI for my 
automation, my intention is I'll submit a job and will monitor the job in 
backend.


Thanks,
Srikant

On 7/25/2013 6:37 PM, Sharon Lucas wrote: 
If you want a STAX job's result to be set to a message then you need to 
return that message from the STAX job's main function using the <return> 
element. 
For example: 

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

<stax> 

 <defaultcall function="test"/> 

 <function name="test"> 
   <sequence> 

     <script>command = 'ls /'</script> 

     <!-- Run a command (e.g. "ls /")and return its stdout/stderr --> 
     <process> 
       <location>'local'</location> 
       <command mode="'shell'">command</command> 
       <stderr mode="'stdout'"/> 
       <returnstdout/> 
     </process> 

     <if expr="RC == 0"> 
       <script>lsOutput = 'Output from "%s" command:\n%s' % (command, 
STAXResult[0][1])</script> 
       <else> 
         <script> 
           lsOutput = '"%s" failed with RC=%s, STAFResult=%s, 
STAXResult=%s' % \ 
                      (command, RC, STAFResult, STAXResult) 
         </script> 
       </else> 
     </if> 

     <message log="1">lsOutput</message> 

     <!-- Get the current date-time --> 
     <script> 
       from time import localtime, strftime 
       currentTime = strftime("%a, %d %b %Y %H:%M:%S", localtime()) 
     </script> 

     <message log="1">'Current date-time: %s' % currentTime</message> 

     <!-- Create a result containing "Hello world", the current date-time, 
and output from "ls /" command --> 
     <script>result = 'Hello world @ %s.\n%s' % (currentTime, 
lsOutput)</script> 

     <!-- Log the result in the STAX Job User Log and send to the STAX 
Monitor messages --> 
     <message log="1">result</message> 

     <!-- Return the result --> 
     <return>result</return> 

   </sequence> 
 </function> 

</stax> 

You can submit a STAX EXECUTE request to run this STAX job and wait for it 
to complete and return its job result as follows: 

# STAF local STAX EXECUTE FILE C:/stax/returnJobResult.xml WAIT 
RETURNRESULT DETAILS 
Response 
-------- 
{ 
 Job ID         : 12 
 Start Date-Time: 20130725-08:02:14 
 End Date-Time  : 20130725-08:02:15 
 Status         : Normal 
 Result         : Hello world @ Thu, 25 Jul 2013 08:02:15. 
Output from "ls /" command: 
Cygwin.bat 
Cygwin.ico 
Thumbs.db 
bin 
cygdrive 
dev 
etc 
home 
lib 
proc 
tmp 
usr 
var 

 Job Log Errors : [] 
 Testcase Totals: { 
   Tests : 0 
   Passes: 0 
   Fails : 0 
 } 
 Testcases      : [] 
} 

For more information on the <return> element, see section "return: Return 
from a Function" in the STAX User's Guide at 
http://staf.sourceforge.net/current/STAX/staxug.html#Header_Return 

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




From:        babuni mishra <bab...@outlook.com> 
To:        "staf-users@lists.sourceforge.net" 
<staf-users@lists.sourceforge.net>, 
Date:        07/25/2013 06:46 AM 
Subject:        [staf-users] simple stax script 



Hi , 
I am a newbie to STAX, wants to use in my automated solution in Linux Env. 

Can any one share me a sample stax script which will return me 
1) hello world message & current date & output of 'ls' (unix command) 

both in STDOUT & in a file. 

I have followed couple of blogs, executed sample stax script aswell, but 
not able to get the result ,  it always comes as 
Result         : None 


Thanks, 
Bab
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users






------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to