You are correct in the the stdout/stderr data will only be returned when 
the command has completed.

In addition to the STDERRTOSTDOUT and RETURNSTDOUT options, you can 
specify the STDOUT <filename> option, specifying a fully-qualified name 
where the stdout/stderr file should be written on the remote machine where 
your command is running (otherwise STAF will create a temporary file for 
you).  Then, while the command is running on the remote machine, you could 
use another tool (such as "tail" if on Unix) to view the content of the 
stdout/stderr file while the command is still running.

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




From:   Tun Wei <wei...@gmail.com>
To:     Sharon Lucas/Austin/IBM@IBMUS, 
Cc:     staf-users@lists.sourceforge.net
Date:   11/30/2011 11:25 AM
Subject:        Re: [staf-users] Question about the STAF log



Hi Sharon:
 
Thank you for the quick reply. I noticed the "STDERRTOSTDOUT" and tried 
it. Please correct me if I am wrong. For the  I found STDERRTOSTDOUT, I 
can only get this output after my remote test func finished. But here, I 
am hoping I can catch the output info during its running. For example, 
when we run our java program, the log4j could log message at any steps of 
the program running. So, is it possible for me to log information in the 
STDERRTOSTDOUT during remote func running.
 
Thanks a lot
Tun


 
On Wed, Nov 30, 2011 at 4:55 PM, Sharon Lucas <luc...@us.ibm.com> wrote:
So, via your Java program, I assume you are submitting a START request to 
the STAF PROCESS service to run your test function command on a remote 
server.  When your test function runs, it writes output to stdout/stderr 
(what you see on the screen when you run it manually).  The STAF PROCESS 
service allows you to redirect stdout/stderr to a file and to return this 
information in the result (so that you can then do whatever you want with 
this information, e.g. print it). 

For example, the following PROCESS START request runs a command that 
writes output to stdout/stderr, waits for it to complete, and returns the 
command's stdout/stderr data in the result. 

C:\>STAF local PROCESS START SHELL COMMAND "java -version" RETURNSTDOUT 
STDERRTOSTDOUT WAIT 
Response 
-------- 
{ 
  Return Code: 0 
  Key        : <None> 
  Files      : [ 
    { 
      Return Code: 0 
      Data       : java version "1.5.0" 
Java(TM) 2 Runtime Environment, Standard Edition (build 
pwi32devifx-20110214 (SR 
12 FP4 )) 
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Windows XP x86-32 
j9vmwi3223ifx-2011 
0208 (JIT enabled) 
J9VM - 20110202_74536_lHdSMr 
JIT  - 20100623_16197ifx3_r8 
GC   - 20100211_AA) 
JCL  - 20110214 

    } 
  ] 
} 

For an example of Java code that submits a similar STAF PROCESS START 
request with the RETURNSTDOUT STDERRTOSTDOUT options and then accesses the 
return code and the stdout/stderr data, see example 4 in section "3.1.1 
Class STAFHandle" in the STAF Java User's Guide at 
http://staf.sourceforge.net/current/STAFJava.htm#Header_STAFHandle. 

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




From:        Tun Wei <wei...@gmail.com> 
To:        staf-users@lists.sourceforge.net, 
Date:        11/30/2011 10:39 AM 
Subject:        [staf-users] Question about the STAF log 




Hi: 
I am new to STAF and I have a basic question about the STAF log. 
  
Right now, by using Java, I can new a STAFHandle and give a request to 
invoke my test function on a remote server. This part is fine. 
  
Now I have a question about the log. Is there any way to new STAF log API 
in java and catch all the information of what's happend on the remote 
server? Let me explain more. 
  
On my remote server, if I open a command-line prompt and run my test func, 
there are lots of information printed line by line on the screen. But when 
I invoke this test func through STAF, I can only see a black  command-line 
prompt opened and there is nothing printed during running. Of course, this 
command-line windows disppear after the test func finsihed. So, here, I 
want to catch those runtime information in my Java program. Is this 
possible? (I do not want to launch another log viever to see those info. I 
want to print the info in my java program) 
  
Thank you very much for the help 
Tun
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to