Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

output log is being cut when executing a script #4108

Meital ·

Hi,

We execute a python script from QuickBild and want a log to print all the script printings.
We use a string buffer to save the output and the log is being cut.

Any idea how can we save and show the full log?

This is our groovy code:
def command = ("python /home/svjer/my_tests/Scripts/automation/ssh.py"
+ " " + vars.getValue("host_ip")
+ " " + vars.getValue("hostname")
+ " " + vars.getValue("pdu_ip")
+ " " + vars.getValue("pdu_port")
+ " " + vars.getValue("number_of_pf")
+ " " + vars.getValue("gpio_ip")
+ " " + vars.getValue("gpio_port"))

logger.warn(command)

logger.info "command to execute is :" + command;
String[] output;
String oneline="";

proc = command.execute()
def outputStream = new StringBuffer();
def erroutputStream = new StringBuffer();
proc.waitForProcessOutput(outputStream, erroutputStream );
logger.info ("out = {} " , outputStream );
logger.info ("error = {}" ,erroutputStream);

And the log we get:

23:17:13,681 INFO - out = /home/svjer/quickbuild-9.0.9/bin
/home/svjer/quickbuild-9.0.9/bin
['/home/svjer/my_tests/Scripts/automation/ssh.py', '10.12.234.244', 'Platform2', '10.12.235.3', '2', '1', '10.12.249.49', '4']
['/home/svjer/my_tests/Scripts/automation/ssh.py', '10.12.234.244', 'Platform2', '10.12.235.3', '2', '1', '10.12.249.49', '4']
start
Test Start Time : 2019-06-11 23:17:12
^^^^^^^^^^^^^^^^^^^^^^^^^^ Setting GPIO Board to Debug MODE ^^^^^^^^^^^^^^^^^^^^^^^^
Child returned {} {}
^^^^^^^^^^^^^^^^^^^^^^^^^^ GPIO Board Set to Debug MODE ^^^^^^^^^^^^^^^^^^^^^^^^
svjer@10.12.234.244's password: $giga

Last login: Tue Jun 11 23:15:37 2019 from 10.12.249.131

[1;32m
############################################
[0m
Fedora release 26 (Twenty Six)
[1;32m
Platform2
[0m
4.16.11-100.fc26.x86_64

Tue Jun 11 04:03:47 IDT 2019

[1;32m
############################################
[0m
################Host Connected###########################


svjer@10.12.234.244's p...

This is the log we supposed to get:

python ssh.py Platform2 Platform2 10.12.235.3 2 1 10.12.249.49 4
['ssh.py', 'Platform2', 'Platform2', '10.12.235.3', '2', '1', '10.12.249.49', '4']
['ssh.py', 'Platform2', 'Platform2', '10.12.235.3', '2', '1', '10.12.249.49', '4']
start
Test Start Time : 2019-06-11 14:17:21
^^^^^^^^^^^^^^^^^^^^^^^^^^ Setting GPIO Board to Debug MODE ^^^^^^^^^^^^^^^^^^^^^^^^
/home/svjer/my_tests/Scripts/automation
/home/svjer/my_tests/Scripts/automation
Child returned {} {}
^^^^^^^^^^^^^^^^^^^^^^^^^^ GPIO Board Set to Debug MODE ^^^^^^^^^^^^^^^^^^^^^^^^
svjer@platform2's password: $giga

Last login: Tue Jun 11 14:16:12 2019 from 10.12.249.131

############################################

Fedora release 26 (Twenty Six)

	    Platform2

     4.16.11-100.fc26.x86_64

  Tue Jun 11 04:03:47 IDT 2019

############################################

################Host Connected###########################


svjer@platform2's password: $giga

Last login: Tue Jun 11 14:17:21 2019 from 10.12.249.131

############################################

Fedora release 26 (Twenty Six)

	    Platform2

     4.16.11-100.fc26.x86_64

  Tue Jun 11 04:03:47 IDT 2019

############################################

################Host Connected###########################


ls /home/svjer/Desktop/Images/ -1t | head -1
[svjer@Platform2 ~$] ls /home/svjer/Desktop/Images/ -1t | head -1
TEST_FVLB1_XXV710_7p00_KR_KR4_SFP28_NCSI_CFGID12p0_Dual_8MB_0.96_80004E8D.bin


TEST_FVLB1_XXV710_7p00_KR_KR4_SFP28_NCSI_CFGID12p0_Dual_8MB_0.96_80004E8D


/net/Platform2/home/svjer/Desktop/Images/TEST_FVLB1_XXV710_7p00_KR_KR4_SFP28_NCSI_CFGID12p0_Dual_8MB_0.96_80004E8D.bin
///////////////////////////// /net/Platform2/home/svjer/Desktop/Images/TEST_FVLB1_XXV710_7p00_KR_KR4_SFP28_NCSI_CFGID12p0_Dual_8MB_0.96_80004E8D.bin
^^start erase
Host.hostname = Platform2
lspci | grep "Ethernet Controller"
[svjer@Platform2 ~$] EEID = 0x80004E8D

**

Important comment: our real script is much longer than this one

**
Thanks,
Meital.

  • replies 7
  • views 2717
  • stars 1
robinshen ADMIN ·

The code seems correct to me. Have you tried to run the same command from command line to see what the output is?

robinshen ADMIN ·

Sorry QB does truncate the log entry if a message is too long for performance reason. In your case, instead of logging outputStream all at once, please split it into lines, and then call logger.info once per line.

Meital ·

Thanks for your answer.

I wanted to ask also if there is any way to get logs during the run time and not to wait until the script will end.

Another question, during the script we need to do some times power cycle, is there any way to use the same steps more than once in the same configuration?

Thanks again,
Meital

robinshen ADMIN ·
drdt ·

Another question, during the script we need to do some times power cycle, is there any way to use the same steps more than once in the same configuration?

I do this all the time. The limitation I found is, you cannot use the same step twice within the same parent. If I want to run a step twice in a row, I put it inside of a serial composition step with repeat parameters.

Leemool ·

Hello ,

The explanation you give interests me in this case , but I cannot put it in place. Can you be more explicit?
When i did : logger.info( Logprocess : {} , util.readOutput(myprocess)); I have only the begin of the process log .

Regards

robinshen ADMIN ·

Something like below:

groovy:
def output = util.readOutput(command);
for (line in com.pmease.quickbuild.util.StringUtils.splitAndTrim(output, '\n')) {
  logger.info(line);
}