log goes invisiable after creating an issue via groovy script

liansheng zhang October 18, 2018
Following codes is to create an issue.

before calling issueService.create(), I add a log "before".
after calling issueService.create(), I add a log "after"

when I go to see the log, only "before" is printed, no "after"
no exception log either.


Weird. it is because issue is creatd in a service? How to show the log.



IssueService issueService = ComponentAccessor.getIssueService();
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters();
issueInputParameters.setProjectId(newProjectObj.getId())
.setIssueTypeId(newIssueTypeId)
.setSummary(issue.getSummary())
.setAssigneeId(assignee)
.setDescription(desc)
// .setComment(desc)
.addCustomFieldValue(epicNameFieldId, issue.getSummary())

IssueService.CreateValidationResult createValidationResult = issueService.validateCreate(curentLoggedInUser, issueInputParameters);

if(!createValidationResult.isValid()){
for(String registeredErrorMessage:createValidationResult.getErrorCollection().getErrors().values())
{
log.warn("validation result: " + registeredErrorMessage);
}
}
else {
try {

log.warn("before")
IssueService.IssueResult createResult = issueService.create(curentLoggedInUser, createValidationResult);
log.warn("after")

if (!createResult.isValid())
{
log.warn("!createResult.isValid() is true")
// Do something
}
}catch(Exception e){
log.("we met exception when creating issue. " + e.getMessage())
}

}

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events