The <log> element only writes to the STAX_Job_<JobID>_User log file on the 
STAX service machine.  Under the covers, it does this by submitting a LOG 
request to the LOG service on the STAX service machine like the following:

STAF local LOG LOG MACHINE LOGNAME STAX_Job_<JobID>_User MESSAGE <Message> 
LEVEL <Level>

If you really wanted to log to a log name other than 
STAX_Job_<JobID>_User, then you can do so by using a <stafcmd> element to 
submit a LOG request to the STAF LOG service and specify whatever logname 
you wanted on whatever machine you wanted.  You could write a small STAX 
function that does this and simply call this function (passing it whatever 
arguments you choose such as the message, log level, logname, machine) 
instead of using the <log> element.

However, when you submit an EXECUTE request to the STAX service, it 
returns the JobID of the STAX job.  So, you can then use that JobID to 
query it's STAX Job Log and STAX Job User Log.  Note this also ensures 
that you'll be logging to a unique log name in case STAX jobs are executed 
in parallel.   For example:

C:\>STAF local STAX EXECUTE FILE c:/dev/src/stax/TestPseudoRun.xml WAIT 
CLEARLOGS
Response
--------
1

Note that 1 is the STAX Job ID.

Or you can submitt the STAX EXECUTE request using the WAIT RETURNRESULT 
option.  You'll still get the STAX Job ID and you'll get the status of the 
STAX Job (e.g. 'Normal', 'Terminated', etc) and the result from the STAX 
job (or None if the STAX job's main function doesn't use the <return> 
element to return a job result). 

C:\>STAF local STAX EXECUTE FILE c:/tests/staxJob1.xml WAIT RETURNRESULT 
CLEARLOGS
Response
--------
Job ID: 2
Result: Success
Status: Normal

My examples all show using the STAF command line executable, but you can 
submit STAF requests via Java, Python, Perl, Tcl, and/or C++ programs 
(which is what you probably want to be doing).  From a program, you can 
submit the STAX EXECUTE request, unmarshall the result to get the Job ID, 
and then you can submit a QUERY request to the LOG service to query the 
STAX Job Logs (or submit a START request to the PROCESS service to run the 
FmtLog utility), using the Job ID returned by the STAX EXECUTE request to 
determine the log name.

C:\>STAF local LOG QUERY MACHINE {STAF/Config/MachineNickname} LOGNAME 
STAX_Job_2
C:\>STAF local LOG QUERY MACHINE {STAF/Config/MachineNickname} LOGNAME 
STAX_Job_2_User

Note that you can even redirect the output to a file if desired.  For 
example:

C:\>STAF local LOG QUERY MACHINE {STAF/Config/MachineNickname} LOGNAME 
STAX_Job_2_User > C:\temp\STAXJob2User.out

Or, if you prefer, you can use the FmtLog utility.

C:\>fmtlog FORMAT LOGFILE 
C:/STAF/data/STAF/service/log/MACHINE/server1/GLOBAL/STAX_Job_2.log 
NEWFILE C:/temp/STAXJob2.out
Formatted 70 record(s) to C:/temp/STAXJob1.out

C:\>fmtlog FORMAT LOGFILE 
C:/STAF/data/STAF/service/log/MACHINE/server1/GLOBAL/STAX_Job_2_User.log 
NEWFILE C:/temp/STAXJob2User.out
Formatted 70 record(s) to C:/temp/STAXJob1User.out

Note too that the Job ID is available to the STAX job that is running via 
STAX variable STAXJobID.   So, you could even query the STAX Job User log 
within your STAX job right before the job ended using a <stafcmd> element 
to submit a QUERY request to the LOG service.  For example:

<stafcmd name="'Query STAX Job User Log'">
  <location>'local'</location>
  <service>'LOG'</service>
  <request>'QUERY MACHINE {STAF/Config/MachineNickname} LOGNAME 
STAX_Job_%s_User' % (STAXJobID)</request>
<stafcmd>

Or, if you preferred, you could run the FmtLog utility to format the STAX 
Job User Log via a <process> element.

Note that you can also list the existing STAX Job Logs.  To get a list of 
all the logs on the local STAX service machine, you could use the 
following STAF log request.  The log files listed whose name begins with 
STAX are the STAX logs.  For example:
STAF local LOG LIST MACHINE {STAF/Config/MachineNickname} 
An example of output from listing STAX logs is:
 
Log Name         Date-Time         Size
---------------- ----------------- ------
STAX_Service     20070510-11:54:50 558601
STAX_Job_1       20070510-11:52:48 597216
STAX_Job_1_User  20070510-11:52:48 228688
STAX_Job_2       20070510-11:53:26 223540
STAX_Job_3       20070510-11:54:34 198001
STAX_Job_3_User  20070510-11:54:34 56788

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   [EMAIL PROTECTED]
(512) 838-8347 or Tieline 678-8347




"Rahul Wagh" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
02/05/2008 09:12 AM

To
<staf-users@lists.sourceforge.net>
cc
"'Rahul Wagh'" <[EMAIL PROTECTED]>
Subject
[staf-users] How to find STAX job user logs file name?






Hi All,

            I am using <log> element in STAX job to log the test cases
result (Pass or fail). I am developing framework which parses the log 
after
STAX job execution. Then it retrieves the information from log file using
FmtLog utility. But if I logged using <log> element in STAX job then STAX
job will log in STAX_Job_JobID_User.log file. 

 So, I have problem while developing framework how to find the logged file
name? Also is there any way where I can change the logging file name from
STAX_Job_JobID_User.log to like tem.log. 

            Thanks, in advance.

 

Regards,

Rahul.


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is 
the property of Persistent Systems Ltd. It is intended only for the use of 
the individual or entity to which it is addressed. If you are not the 
intended recipient, you are not authorized to read, retain, copy, print, 
distribute or use this message. If you have received this communication in 
error, please notify the sender and delete all copies of this message. 
Persistent Systems Ltd. does not accept any liability for virus infected 
mails.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Attachment: winmail.dat
Description: Binary data

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to