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.

Analize a step log to extract info from application log #4052

icnaan ·

I am using a CLI tool that I have no access to it's code, the information I wish to return to the build flow is in the CLI STD output, I have tried to add a script in the Post-Execute Action and with the idea to analyze the log output of the CLI and using some String manipulation and vars.get().setValue() to communicate the information picked up from the log to the other steps int he build.
I added this code:

groovy: "build ==" + build; "Output ==" + build.renderLogAsText();

I get a object of the build alright, but the nothing back from build.renderLogAsText()

I assumed that log is not ready at the time of the execution and tried build.getPrevious().renderLogAsText(); - this also return nothing
Any idea of now to properly analyze a CLI output ?
Note: I have seen the Analyze logs option ... I am not trying to decide the success - I am trying to get info from the log stream.

P.S. the log is something like: "Map version found - 1.02 - new map version is - 1.05"

  • replies 5
  • views 29
  • stars 0
icnaan ·

A bit of info:
System Date and Time 2019-02-19 16:41:06
Operating System Linux 3.0.101-, amd64
JVM Java HotSpot(TM) 64-Bit Server VM 1.8.0_141, Oracle Corporation
QuickBuild Version 8.0.36 - Thu Jan 31 06:47:48 IST 2019
Total Heap Memory 7.11 GB
Used Heap Memory 1.23 GB

robinshen ADMIN ·

Instead of calling your cli tool with shell/batch step, use a script execution step (misc/execute specified step) to run below script:

def sout = new StringBuilder(), serr = new StringBuilder()
def proc = '/path/to/your/cli'.execute()
proc.consumeProcessOutput(sout, serr)
// do some parse here against sout and store the result as sResult
icnaan ·

neat - thanks
I had a fixation on being able to analize the Stderr / stdout while the CLI logs in the usual way .. this will work.

icnaan ·

the last line should be:

robinshen ADMIN ·

My mistake. Thanks for pointing this out.