how to get access to Hudson's "console output"? how to get access to Hudson's "console output"? shell shell

how to get access to Hudson's "console output"?


  1. It is saved along with the artifacts (the log file in top-level of build's directory, i.e. jobs/jobname/builds/buildid/log).
  2. It is automatically added to the email hudson sends, though truncated from begining.

If you need to get it anywhere else, there are two options:

  1. You can have to wrap the script in a block and pipe it's output through tee. So you'd convert:

    #!/bin/shmake thismake that

    to:

    #!/bin/bash{    make this    make that} 2>&1 | tee output# Now the output is in file 'output' while Hudson did see it.

    Unfortunately I am not sure how to force line-buffering in tee so the real-time log printing works in Hudson (at least my cygwin version does not mention -u option).

  2. You could use the Groovy plugin and/or Groovy Postbuild plugin to access the internal API. The "system" groovy script in build step and the post-build groovy script both have access to the build object (though in slightly different way) of type hudson.model.AbstractBuild and from that you can get the content of the console using the hudson.model.Run#getLog(int) method.


To force line-buffering in tee, just start the program with unbuffer {command} which is part of the expect package. Another alternative to unbuffer is to use stdbuf -eL -oL {command}