It's all about the answers!

Ask a question

Retrieve Build Log


Praveen Kumar (371622) | asked Jun 17 '13, 4:35 a.m.
I wanted to retrieve build log using JAVA API or Rest API.  Can some one please suggest how to get this done.

Accepted answer


permanent link
Nick Edgar (6.5k711) | answered Jul 15 '13, 1:41 p.m.
JAZZ DEVELOPER
edited Jul 15 '13, 2:07 p.m.
A later comment in the thread mentioned by Lauren shows how to get the internal ids for the build result and file contribution needed to form the URL.  But since you're starting from Java, I assume you'd prefer to get the content via the Java client API, which would avoid having to reauthenticate, etc.

For log files (and other contributions with associated file content in the RTC repository), you can use:
com.ibm.team.build.common.model.IBuildResultContribution.getExtendedContributionData()
to get the content descriptor (an IContent).

To retrieve the contents given the IContent, use ITeamRepository.contentManager() then one of IContentManager's retrieve methods:
  • com.ibm.team.repository.client.IContentManager.retrieveContent(IContent, OutputStream, IProgressMonitor)
  • com.ibm.team.repository.client.IContentManager.retrieveContentStream(IContent, String, LineDelimiter, IProgressMonitor)
  • com.ibm.team.repository.client.IContentManager.retrieveContentStream(IContent, IProgressMonitor)

Praveen Kumar selected this answer as the correct answer

Comments
Praveen Kumar commented Jul 18 '13, 4:48 a.m.

 Thanks Egar


Praveen Kumar commented Jul 18 '13, 4:49 a.m.

Sorry to spell you incorrectly.  Thanks Edgar.

2 other answers



permanent link
Lauren Hayward Schaefer (3.3k11427) | answered Jun 17 '13, 6:57 a.m.
JAZZ DEVELOPER
Hi,
I found this forum post that should get you started:  https://jazz.net/forum/questions/57724/fetch-build-log-from-an-ibuildresult-object

Comments
Praveen Kumar commented Jul 12 '13, 10:27 a.m.

Yes the post mentioned has helped us to retrieve the log file name.  But using the log file name how do I get to the log file content.  As the post said, a typical log file URL is like this.... 



permanent link
Nick Edgar (6.5k711) | answered Jul 15 '13, 1:48 p.m.
JAZZ DEVELOPER
There's also the logRetriever Ant task (since 4.0), but it requires an exact file name to match.  It would be better if we generalized this to support pattern matching.  I have filed: Allow logRetriever and artifactFileRetriever Ant tasks to match against a file name pattern (272733)

Your answer


Register or to post your answer.