Can i download the build log of successful teamcity job using REST api?

Hi Team,
I need to download the build log of a specific job with using REST api. I couldn't get the pattern for it in the documentaion.
Please can you help on this.



Thanks, Ramesh

5 comments
Comment actions Permalink

Hi,

To download build log please use:

http://teamcity:8111/httpAuth/downloadBuildLog.html?buildId=<build id>

It is impossible to perform it using one REST API command, you need to write a script. Have a look at example of script in this comment.
Feel free to create new feature request here http://youtrack.jetbrains.com/issues/TW.

0
Comment actions Permalink

Hi Mishina,
Investigating of some time, i am able to download the build log of  successful teamcity build using Groovy Ant Builder.
##########################
def ant = new AntBuilder()
def username = "myuser"
def password = "mypwd"
def url = "http://teamcity00"
//To get the id of last successful build id of teamcity job
ant.get(dest : "logs/id.txt", username:"$username", password:"$password",src:"$url/httpAuth/app/rest/buildTypes/id:<teamcity_job_id>/builds/status:SUCCESS/id")
def buildId=new File("logs/id.txt").text
println buildId
ant.get(dest : "logs/buildlog.txt", username:"$username", password:"$password", src:"$url/downloadBuildLog.html?buildId=$buildId")
new File("logs/buildlog.txt").text
##########################


Thanks, Ramesh

0
Comment actions Permalink

Hi,

is there a way to download the RAW log files? I mean the STDOUT and STDERR of the build steps without the information added by TeamCity ("[14:27:23] :     [Step 3/5] ")?

Cheers,
Olivier

0
Comment actions Permalink

Hi Olivier,

It is not possible in TeamCity now. You can find build log in <Build agent home>/logs/teamcity-build.log file. Please watch and vote for the related issue.

0
Comment actions Permalink

Hi Alina,

done, thank you for the link.

0

Please sign in to leave a comment.