Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Add Log To Build Result

Hi,

I'm wondering if it's possible to add a log file to the build result? We get the default log, "Full Build Log", but I'd like to add another that comes out of the build so that it's easily accessible.

Is this possible if we aren't using Ant?

Thanks,
Lachlan Hillman.

0 votes



14 answers

Permanent link
Hi,

I'm wondering if it's possible to add a log file to the build result? We get the default log, "Full Build Log", but I'd like to add another that comes out of the build so that it's easily accessible.

Is this possible if we aren't using Ant?

Thanks,
Lachlan Hillman.


Hi,

The Logs tab in the Eclipse UI has a button to add a log file and you already know of the Ant task. Another option is to use the Java API to code a program to add a log (which is essentially what the Ant task does).

Brent Ulbricht
RTC Build Lead

1 vote


Permanent link
Hi,

I'm wondering if it's possible to add a log file to the build result? We get the default log, "Full Build Log", but I'd like to add another that comes out of the build so that it's easily accessible.

Is this possible if we aren't using Ant?

Thanks,
Lachlan Hillman.


Hi,

The Logs tab in the Eclipse UI has a button to add a log file and you already know of the Ant task. Another option is to use the Java API to code a program to add a log (which is essentially what the Ant task does).

Brent Ulbricht
RTC Build Lead

Hi,

Thanks for the response.

I need to do this programatically (thus the "Add File" button in the RTC UI isn't a viable option). In terms of replicating the Ant Task, is there any API documentation I could refer to? Is there even an exposed API? Do you have any advice regarding how I could go about this?

Thanks,
Lachlan Hillman.

0 votes


Permanent link
Hi,

I'm wondering if it's possible to add a log file to the build result? We get the default log, "Full Build Log", but I'd like to add another that comes out of the build so that it's easily accessible.

Is this possible if we aren't using Ant?

Thanks,
Lachlan Hillman.


Hi,

The Logs tab in the Eclipse UI has a button to add a log file and you already know of the Ant task. Another option is to use the Java API to code a program to add a log (which is essentially what the Ant task does).

Brent Ulbricht
RTC Build Lead

Hi,

Thanks for the response.

I need to do this programatically (thus the "Add File" button in the RTC UI isn't a viable option). In terms of replicating the Ant Task, is there any API documentation I could refer to? Is there even an exposed API? Do you have any advice regarding how I could go about this?

Thanks,
Lachlan Hillman.

Hi,

You'll need to check out the com.ibm.team.build.client.ITeamBuildClient addBuildResultContribution method. There are some Build code examples (but not for how to add a log) at https://jazz.net/wiki/bin/view/Main/BuildJavaProgrammingExamples .

Brent Ulbricht
RTC Build Lead

0 votes


Permanent link
I suggest checking out the source for:
com.ibm.team.build.ant.task.LogPublisherTask
which delegates to:
com.ibm.team.build.internal.publishing.LogPublisher
which extends:
com.ibm.team.build.internal.publishing.ContentPublisher ->
com.ibm.team.build.internal.publishing.AbstractFilePublisher ->
com.ibm.team.build.internal.publishing.AbstractContributionPublisher

The essence of it is in com.ibm.team.build.internal.publishing.AbstractContributionPublisher.publish(IBuildResultHandle, BuildStatus, ITeamRepository) which does:

IBuildResultContribution contribution = BuildItemFactory.createBuildResultContribution();
contribution.setLabel(fLabel);
contribution.setImpactsPrimaryResult(true);
contribution.setStatus(contributionStatus);
contribution.setExtendedContributionTypeId(fExtendedContributionTypeId);

if (fComponentName != null) {
contribution.setComponentName(fComponentName);
}

initializeContribution(contribution, teamRepository);

ClientFactory.getTeamBuildClient(teamRepository).addBuildResultContribution(buildResultHandle, contribution,
null);

return contribution;


The contribution type id to use is com.ibm.team.build.common.model.IBuildResultContribution.LOG_EXTENDED_CONTRIBUTION_ID

initializeContribution comes from AbstractFilePublisher:

protected void initializeContribution(IBuildResultContribution contribution, ITeamRepository teamRepository)
throws TeamRepositoryException {

contribution.setExtendedContributionData(getFileContent(teamRepository));
contribution.setExtendedContributionProperty(IBuildResultContribution.PROPERTY_NAME_FILE_NAME, new File(
fFileLocation).getName());
}

and getFileContent (which creates the IContent blob from the file) is in ContentPublisher:

protected IContent getFileContent(ITeamRepository teamRepository) throws TeamRepositoryException,
TeamBuildException {
File file = new File(getFilePath());
IContent content = null;

try {
String contentType = getContentType();

if (ContentUtil.isTextContentType(contentType)) {
content = storeTextContent(contentType, file, teamRepository);
} else {
content = teamRepository.contentManager().storeContent(contentType, null,
LineDelimiter.LINE_DELIMITER_NONE, new FileInputStream(file), null, new NullProgressMonitor());
}
} catch (FileNotFoundException exception) {
throw new TeamBuildException(exception);
}

return content;
}

0 votes


Permanent link
Thanks very much for the help, guys.

Trying to take step #1, and stumbling already! For some reason I'm getting a NullPointerException when running the QueryBuildsWithTagExample from https://jazz.net/wiki/bin/view/Main/BuildJavaProgrammingExamples

Here's the stack trace:


Exception in thread "main" java.lang.NullPointerException
at com.ibm.team.repository.transport.client.ValidatingX509TrustManager.initializeBaseTrustManager(ValidatingX509TrustManager.java:56)
at com.ibm.team.repository.transport.client.ValidatingX509TrustManager.<init>(ValidatingX509TrustManager.java:99)
at com.ibm.team.repository.transport.client.ValidatingX509TrustManager.<init>(ValidatingX509TrustManager.java:79)
at com.ibm.team.repository.transport.client.SecureInterruptableSocketFactory.<init>(SecureInterruptableSocketFactory.java:117)
at com.ibm.team.repository.transport.client.RemoteTeamServer.buildHostConfiguration(RemoteTeamServer.java:245)
at com.ibm.team.repository.transport.client.RemoteTeamServer.ensureInitialized(RemoteTeamServer.java:212)
at com.ibm.team.repository.transport.client.RemoteTeamServer.setCredentials(RemoteTeamServer.java:473)
at com.ibm.team.repository.client.internal.TeamRepository.<init>(TeamRepository.java:384)
at com.ibm.team.repository.client.internal.TeamRepositoryService.createSharedTeamRepository(TeamRepositoryService.java:400)
at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeamRepository(TeamRepositoryService.java:111)
at com.ibm.team.repository.client.internal.TeamRepositoryService.getTeamRepository(TeamRepositoryService.java:130)
at QueryBuildsWithTagExample.login(QueryBuildsWithTagExample.java:112)
at QueryBuildsWithTagExample.main(QueryBuildsWithTagExample.java:72)


The repository URL, username and password are 100% certainly valid (copy-pasted directly out of a working RTC client), and the RTC host is definitely accessible from this machine (I regularly check out source using the Jazz SCM tools).

If you guys have any ideas, please let me know.

P.S. The RTC server is version 3, and I have version 3 of the SDK.

0 votes


Permanent link
Not sure about that particular NPE. I've not seen it before. First thing to check is that you're not using an old JDK/JRE. I suggest using the one we ship with the RTC client (or server).
See https://jazz.net/wiki/bin/view/Main/BuildFAQ#WhichJDK

0 votes


Permanent link
Not sure about that particular NPE. I've not seen it before. First thing to check is that you're not using an old JDK/JRE. I suggest using the one we ship with the RTC client (or server).
See https://jazz.net/wiki/bin/view/Main/BuildFAQ#WhichJDK


Thanks for the response.

This is what I've been doing. I've been pointing to the jdk that comes with the JBE (which has been used to access the same RTC server). For reference, this version is:

IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux x86-32)

The fact that it's failing on some sort of certificate related function tells me that it may be a configuration problem on my local machine. I'm just not sure what. Is there any way to view the source code for the class in question? (com.ibm.team.repository.transport.client.ValidatingX509TrustManager)

0 votes


Permanent link
Found a similar workitem here:
97073: NPE when running API snippet code from server.

Are you developing against 2.x, 3.0 or 3.0.1?

For source code, check the bottom of the 'all downloads' tab for the release, e.g.
https://jazz.net/downloads/rational-team-concert/releases/3.0.1?p=allDownloads

That work item talks about having an incorrect library setup. No further details, unfortunately, but you could follow up in there. If you're not doing so already, I suggest following the setup instructions in the SDK doc:
https://jazz.net/wiki/bin/view/Main/RtcSdk30

0 votes


Permanent link
Found a similar workitem here:
97073: NPE when running API snippet code from server.

Are you developing against 2.x, 3.0 or 3.0.1?

For source code, check the bottom of the 'all downloads' tab for the release, e.g.
https://jazz.net/downloads/rational-team-concert/releases/3.0.1?p=allDownloads

That work item talks about having an incorrect library setup. No further details, unfortunately, but you could follow up in there. If you're not doing so already, I suggest following the setup instructions in the SDK doc:
https://jazz.net/wiki/bin/view/Main/RtcSdk30


Our RTC server is version 3. I've tried the following SDK versions:

2.0.0.1
2.0.0.2iFix6
3.0
3.0iFix1
3.0.1

Exact same error for all of them.

Anybody have any more ideas?

0 votes


Permanent link
Found a similar workitem here:
97073: NPE when running API snippet code from server.

Are you developing against 2.x, 3.0 or 3.0.1?

For source code, check the bottom of the 'all downloads' tab for the release, e.g.
https://jazz.net/downloads/rational-team-concert/releases/3.0.1?p=allDownloads

That work item talks about having an incorrect library setup. No further details, unfortunately, but you could follow up in there. If you're not doing so already, I suggest following the setup instructions in the SDK doc:
https://jazz.net/wiki/bin/view/Main/RtcSdk30


Our RTC server is version 3. I've tried the following SDK versions:

2.0.0.1
2.0.0.2iFix6
3.0
3.0iFix1
3.0.1

Exact same error for all of them.

Anybody have any more ideas?

This old post in the 'Extending Team Concert' displays the same exception. You might try asking if they ever solved the issue.

Brent Ulbricht
RTC Build Lead

0 votes

1–15 items
page 1of 1 pagesof 2 pages

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Sep 05 '11, 12:28 a.m.

Question was seen: 13,514 times

Last updated: Sep 05 '11, 12:28 a.m.

Confirmation Cancel Confirm